以下 PHP 代码
public function go()
{
$controller = ucfirst($this->getController());
$method = $this->getAction();
require_once VENDOR_PATH . DS . 'Core/Controller/Controller.php';
require_once VENDOR_PATH . DS . 'Application/Controller/' . $controller . '.php';
$ctl = new $controller;
$ctl->$method();
}
正在生产一个
Fatal error: Class 'Index' not found in /path/to/core/Dispatch.php on line 108
但是,我验证了核心控制器和应用程序控制器都在加载。
控制器.php:
namespace Core\Controller;
class Controller
{
public function __construct()
{
// @TODO
}
}
索引控制器
namespace Application\Controller;
use Core\Controller\Controller;
class Index extends \Core\Controller\Controller {
public $input;
public function __construct()
{
parent::__construct();
die('In Application Controller');
}
}