【发布时间】:2012-06-26 15:26:31
【问题描述】:
我正在做一个 PHP 项目,我在 require_once(甚至在 require)中遇到错误
Warning: require_once(C:/wamp/www/MyFiles/MyProject/includes/db_config.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\MyFiles\MyProject\includes\autoloads.php on line 9
Fatal error: require_once() [function.require]: Failed opening required 'C:/wamp/www/MyFiles/MyProject/includes/db_config.php' (include_path='.;C:\php5\pear') in C:\wamp\www\MyFiles\MyProject\includes\autoloads.php on line 9
这就是我包含文件的方式
$root = $_SERVER['DOCUMENT_ROOT'];
//config..
require_once($root . '/MyFiles/MyProject/includes/db_config.php');
我尝试过使用
echo $root . '/MyFiles/MyProject/includes/db_config.php';
正在正确打印 URL
即C:\wamp\www\MyFiles\MyProject\includes\db_config.php
我正在使用 WAMP 服务器 5 autload.php 和 db_config.php 在同一个文件夹中
【问题讨论】:
-
您确定文件 (
db_config.php) 位于该目的地吗? -
是的,文件位于同一路径
-
我必须在 PHP.ini 中进行任何配置吗?
-
密码从不说谎。不可能。
-
好吧,如果它真的在打印
C:\wamp\www\MyFiles\MyProject\includes\db_config.php,那么没有。
标签: php