<?php
/**
* Created by PhpStorm
* Author Админ
* Date 17.10.18
* Time 21:14
*/
class Index
{
public function onServerIndex()
{
if ($_SERVER['REQUEST_URI'] == '/')
{
$page = 'index';
}else{
$page = substr($_SERVER['REQUEST_URI'], 1);
}
if ($page == 'index')
{
include "page/index.php";
}else{
if ($page == 'login')
{
include "auth/login.php";
}else{
exit('Страница 404');
}
}
}
}
?>
class Index
{
public function onServerIndex()
{
if ($_SERVER['REQUEST_URI'] == '/')
{
$page = 'index';
}else{
/* убираем не только первый, но и последний слэш */
$page = substr($_SERVER['REQUEST_URI'], 1, -1);
}
if ($page == 'index')
{
include "page/index.php";
}else{
if ($page == 'login')
{
include "auth/login.php";
}else{
exit('Страница 404');
}
}
}
}