Can';t包括名为“的文件”;config.php";在我的PHP应用程序中(它被忽略)
我有以下目录结构:Can';t包括名为“的文件”;config.php";在我的PHP应用程序中(它被忽略),php,apache,xampp,filenames,require-once,Php,Apache,Xampp,Filenames,Require Once,我有以下目录结构: /app /controlers /models /views init.php config.php /www index.php /www/index.php调用init文件的代码: include_once '../app/init.php'; 然后在/app/init.php中,我有: require_once 'config.php'; require_once 'routes.php'; 由于某些原因,conf
/app
/controlers
/models
/views
init.php
config.php
/www
index.php
/www/index.php调用init文件的代码:
include_once '../app/init.php';
然后在/app/init.php中,我有:
require_once 'config.php';
require_once 'routes.php';
由于某些原因,config.php文件未加载。如果我将其重命名为config2.php并更改include,则一切正常。当我切换回原来的名字时,它又被忽略了。是否有可能以某种方式保留文件名
我正在使用XAMPP附带的Apache。当您希望包含来自同一目录的文件时,请使用
require_once './config.php';
require_once './routes.php';
或
否则,您的include\u路径中具有相同名称的文件可能会被包含
require_once __DIR__.'/config.php';
require_once __DIR__./'routes.php';