itmo-php-course/engine/index.php

76 lines
1.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// require_once './core/Autoloader.php';
// Autoloader::init();
// Включение отображения ошибок на время разработки сайта
ini_set('display_errors', 1);
define('ROOT', dirname(__FILE__));
error_reporting(E_ALL);
require_once __DIR__ . '/vendor/autoload.php';
use Shalex\Engine\Router;
// Подключаем файл Router.php используя следующие команды:
require_once (ROOT . '/core/Router.php');
//проверка: echo ROOT; (C:\OSPanel\domains\test2)
// создаем экземпляр класса Router
$router = new Router();
// и запускаем метод run(), тем самым, передав на него управление
$router->run();
exit;
// var_dump($_SERVER['REQUEST_URI']);
// $uri = trim($_SERVER['REQUEST_URI'], '/');
// $mass_uri = explode('/', $uri);
// var_dump($mass_uri);
// $controller = $mass_uri[0];
// $action = $mass_uri[1] ? $mass_uri[1] : 'index';
// $nameClassController = ucfirst($controller) . 'Controller';
// $cntr = new $nameClassController;
// $cntr->$action();
// class MainModel
// {
// public function getData()
// {
// return [
// 'title' => 'Main Page',
// 'h3' => 'С новым годом!'
// ];
// }
// }
// class MainController
// {
// public function index()
// {
// $model = new MainModel();
// $view = new MainView();
// $result = $model->getData();
// $view->render($result, 'main.tpl');
// }
// }
// class MainView
// {
// public function render($data, $tmpl)
// {
// var_dump($data);
// }
// }
// $cont = new Route();