index.phprequire_once '../vendor/autoload.php';
$router = components\Router::getInstance();
Routernamespace components;
use controllers;
class Router {
....
public function init($routes) {
.....
$obj = new $controller_name; // HomeController
$result = call_user_func($obj->$controller[1]); // index
.....
composer.json
После добавления psr было:
composer dumpautoload -o
и
composer dumpautoload "autoload": {
"psr-0": {
"components\\": "components/",
"controllers\\": "controllers/",
"models\\": "models/"
}
}
Структура:
./components
./controllers
./models
./web/
./web/index.php
Ошибка:Fatal error: Class 'HomeController' not found