Answer the question
In order to leave comments, you need to log in
Composer doesn't load classes specified in autoload, why?
index.php
require_once '../vendor/autoload.php';
$router = components\Router::getInstance();
namespace components;
use controllers;
class Router {
....
public function init($routes) {
.....
$obj = new $controller_name; // HomeController
$result = call_user_func($obj->$controller[1]); // index
.....
"autoload": {
"psr-0": {
"components\\": "components/",
"controllers\\": "controllers/",
"models\\": "models/"
}
}
Fatal error: Class 'HomeController' not found
Answer the question
In order to leave comments, you need to log in
Fatal error: Class 'HomeController' not found
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question