,因此我需要在上面的3个目录中包括一个配置文件。文件结构:root/template/default/premium/myfile.php我正在尝试包括:root/include/config.php
我的尝试:
if(include('../../../include/config.php') == true){
echo "Config loaded succesfully<br>";
}else{
echo "There was a Big Time Error loading the Config!<br>";
}
这个不起作用,我不断收到大的时间错误消息;(
接下来我尝试了:
include($_SERVER['DOCUMENT_ROOT'] . '/include/config.php');
如果我尝试访问我的定义不起作用,也没有运气。
在Dormilich建议检查手册后,我发现了一个错误并更改了我的代码如下:
if((include'../../../include/config.php') == true){
echo "Config loaded succesfully<br>";
}else{
echo "There was a Big Time Error loading the Config!<br>";
}
仍然不起作用
if((include $_SERVER['DOCUMENT_ROOT'] . '/include/config.php') == true)
{
echo "Config loaded succesfully<br>";
}
else
{
echo "There was a Big Time Error loading the Config!<br>";
}
这对我有用。我想我可能只是在某个地方失误。但仍然感谢您再次注意手册。