在php中使用include

Wit*_*ors 0 php dreamweaver include

我有一个名为header的文件(我的网站的标题)..我在我的所有网站中使用该文件.问题在于它包括:

include_once("../untitled/sanitize_string.php");
Run Code Online (Sandbox Code Playgroud)

这意味着可能会抛出错误,具体取决于谁调用头文件.

我有目录,子目录和子目录到子目录..是否有一种简单的方法来防止这种情况发生..而不是采取satize字符串包括并将其放在每个页面而不是在头文件中

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
Run Code Online (Sandbox Code Playgroud)

致命错误:require_once()[function.require]:在C:\ xampp\htdocs\PoliticalForum\StoredProcedure中打开所需的'/untitled/sanitize_string.php'(include_path ='.; C:\ xampp\php\PEAR')失败第7行的\ User\headerSite.php

Vis*_*ons 5

您可以考虑在使用include时设置全局包含路径.