我的网站在生产服务器上完美运行。我已将其移至另一个网络服务器。 (VPS)。
让我用例子来解释一下:
目录结构:
includes/
header.php
business/
index.php
some other files...
index2.php
在我之前的版本中,我使用了
include_once(includes/header.php)
在index.php和index2.php中。它运行良好。但在我的新服务器设置中,它给了我有关路径的错误(显然)。
ERROR:
include_once(includes/header.php): failed to open stream: No such file or directory
正因为如此:
Fatal error: Class 'EncryptionClass' not found
我认为我需要做一些服务器配置。但是,我不知道怎么办?
请指导我。如果您需要更多信息,请告诉我。
如果使用 PHP 5.3+ 尝试使用:
include_once(__DIR__.'/includes/header.php');
DIR https://www.php.net/manual/en/language.constants.predefined.php是一个神奇的常量,它将返回文件所在的完整目录。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)