工作,我有我在哪裏使用include_path
一個構造函數,該函數是這樣的:包含路徑將不會PhpStorm
public function __construct()
{
$url = $this->parseUrl();
if(file_exists('application\controllers'.$url[0].'.php')){
$this->controller=$url[0];
unset($url[0]);
}
require_once 'application\controllers'.$this->controller.'.php';
echo $this->controller;
}
不幸的是,當我嘗試加載現有的控制器的url像這樣的http://localhost/project/public_html/home
我出現以下錯誤:
Warning: require_once(application\controllers home.php): failed to open stream: No such file or directory in C:\xampp\htdocs\project\application\core\App.php on line 24
Fatal error: require_once(): Failed opening required 'application\controllers home.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\project\application\core\App.php on line 24
我跟着documentation和我包括路徑:
C:\xampp\htdocs\project\application
和
C:\xampp\htdocs\project\application\controllers
,但我仍然得到錯誤,我只是無言以對爲什麼...有人可以幫助我嗎?
你可能會錯過'\',它應該是'application \ controllers \'。$ this-> controller。'。php'; –