我正在开发一个 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
IE C:\wamp\www\MyFiles\MyProject\includes\db_config.php
我正在使用 WAMP 服务器 5 autload.php 和 db_config.php 在同一个文件夹中