如何使用php.ini在Wamp-www文件夹外包含路径


How can I include a path outside the Wamp www folder using php.ini ?

我的项目使用一些全局文件,这些文件应该包含在www文件夹之外。

我试着在php.ini中包含这样的路径

include_path = ".;c:'php'includes;c:'Users'Pim'Documents'CMS'globals'php"

这个全局php文件夹包含一些我想包含在www文件夹中的项目中的文件。

例如,我想包括c:''Users''Pim''Documents''CMS''globals''php''system''init.php通过在www文件夹中的de index.php中执行此操作:

include 'system/init.php';

到目前为止我做错了什么?

当我检查本地主机的phpinfo时,我会说:

include_path
。;c: ''php''includes;c: ''Users''Pim''Documents''CMS''globals''php;(本地值)。;c: ''php''includes;c: ''Users''Pim''Documents''CMS''globals''php;(主值)

使用include 'system/init.php';告诉PHP从特定文件夹中包含。

您告诉php,该文件夹应该存在于执行脚本的当前文件夹之下。

尝试

include 'init.php';

然后它将搜索包含路径

是否尝试使用相对路径包含?

我在examplep-htdocs的C:/tmp/test.php中使用了examplep-include "/tmp/test.php",它已经起作用了。

您将作为include "tmp/test.php"执行此操作,其中包括子目录