【发布时间】:2011-11-05 12:40:17
【问题描述】:
我有一个名为 header 的文件(我网站的标题)。我在所有网站中都使用该文件。问题是它包含以下内容:
include_once("../untitled/sanitize_string.php");
这意味着可能会抛出错误,这取决于谁调用了头文件。
我有目录,子目录和子目录的子目录..有没有一种简单的方法可以防止这种情况发生..而不是将饱和字符串包含并将其放在每个页面上而不是头文件中
Warning: require_once(/untitled/sanitize_string.php) [function.require-once]: failed to open stream: No such file or directory in C:\xampp\htdocs\PoliticalForum\StoredProcedure\User\headerSite.php on line 7
致命错误:require_once() [function.require]:在 C:\xampp\htdocs\ 中打开所需的 '/untitled/sanitize_string.php' (include_path='.;C:\xampp\php\PEAR') 失败政治论坛\StoredProcedure\User\headerSite.php 第 7 行
【问题讨论】:
-
请发
sanitize_string.php的内容。它很可能包含没有正确处理缺失变量等错误的代码。这是要解决的问题。 -
使其相对于定义的路径,例如您网站的文档根目录。我使用一个常量来做到这一点;有几种方法可以确定路径。
标签: php include dreamweaver