无法包含子文件夹中的文件-PHP
这是包含子文件夹中的文件的行,但出现错误无法包含子文件夹中的文件-PHP,php,include,Php,Include,这是包含子文件夹中的文件的行,但出现错误 include('../classes/user.php'); 错误: PHP警告:include():在/home/site/public_html/sm/assets/includes/config.PHP中打开“../classes/phpmailer/mail.PHP”以包含(include_path=”:/opt/cpanel/ea-php56/root/usr/share/pear)失败 我也试过了 include(__DIR__ .'/c
include('../classes/user.php');
错误:
PHP警告:include():在/home/site/public_html/sm/assets/includes/config.PHP中打开“../classes/phpmailer/mail.PHP”以包含(include_path=”:/opt/cpanel/ea-php56/root/usr/share/pear)失败
我也试过了
include(__DIR__ .'/classes/user.php');
但同样的错误。
你知道怎么解决吗?
谢谢。您的代码表明您要包含的文件位于文件夹中:
/home/site/public_html/sm/assets/classes/user.php
如果情况并非如此,例如:
/home/site/public_html/classes/user.php
您需要添加如下内容:
include '../../../classes/user.php';
--编辑:
我现在还看到错误实际上是关于“./classes/phpmailer/mail.php”
似乎mail.php不在那个地方。。。您可能需要首先验证这一点。错误来自config.php。因此,请检查include for mail.php并检查路径猜测一下,我会说该文件不存在或您没有读取该文件的权限。可能重复的错误不是来自您要包含的文件,而是来自另一个也包含的文件。请参阅错误消息上的路径。