谁来帮帮我
PHP Fatal error: require_once() enter code here[<a href='function.require'>function.require</a>]: Failed opening required '/include/tables.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home2/uaeadver/public_html/include/include.php on line 14
我把include.php也包含在这里
$path=dirname(__FILE__);
global $minimal;
if(!file_exists($path.'/../config.php')) header("Location: install/");
require_once($path.'/../config.php');
if(!isset($config_abs_path) || !isset($config_live_site)) header("Location: install/");
require_once($config_abs_path.'/include/tables.php');
如果两个文件在同一个目录
require_once('include.php');
和使用退出目录../
,如
require_once('../include.php');
您尝试进入基目录的方式不正常,或者您尝试包含的文件不存在。
如果有帮助,使用getcwd()
函数让返回当前工作目录。
一般来说,你总是从相同的路径启动应用程序,你可以define()
一个绝对的基本路径,并使用它来代替:
// define'd constants are always global scope:
define('BASE_PATH', '/home2/uaeadver/public_html/');
require(BASE_PATH . 'include/config.php');
Location change后缺失exit;
:
if(!file_exists($path.'/../config.php')) {
header("Location: install/");
exit;
}
你的代码风格确实需要改进。不要使用全局变量,尝试真正的设计模式和严格的编码标准。