警告:require_once(/home/orgdevelopers.tk/public_html/ok/app/Config/constant.php):无法打开流:没有这样的文件或目录

问题描述

您可以在 http://orgdevelopers.tk/api/app/Config/core.PHP 上看到错误 我的 PHP 版本是 7.0.33。 执行 PHP 文件时出现此错误。请帮忙。

{Warning: require_once(/home/orgdevelopers.tk/public_html/ok/app/Config/constant.PHP): Failed to open stream: No such file or directory in /home/orgdevelopers.tk/public_html/ok/core.PHP on line 3

Fatal error: require_once(): Failed opening required '/home/orgdevelopers.tk/public_html/ok/app/Config/constant.PHP' (include_path='.:/usr/local/lsws/lsPHP70/share/pear:/usr/local/lsws/lsPHP70/share/PHP:/usr/share/pear:/usr/share/PHP') in /home/orgdevelopers.tk/public_html/ok/core.PHP on line 3}

core.PHP line 3 is== require_once('app/Config/constant.PHP');

解决方法

如果两个文件都在同一个目录下,constant.phprequire_once函数中core.php的路径应该是constant.php或者/api/app/Config/constant.php或者{{1} } 而不是 __DIR__.'/constant.php'