【发布时间】:2017-05-17 19:15:19
【问题描述】:
我正在尝试包含一个文件,我已经在我现在遇到问题的确切页面上成功地完成了该文件。由于某种原因,以下调用不起作用。三种方法我都试过了。
require_once ("required_files/page-count.php");
require_once 'required_files/page-count.php';
include_once("required_files/page-count.php");
最初我将文件夹命名为php 而不是required_files,我收到了错误消息,所以我更改了它,认为 php 可能是一个受限文件夹名称。现在,由于我已更改它,它似乎仍在搜索我以前的名称,但它不在我的代码中。
错误:
警告:require_once(php/page-count):无法打开流:第 40 行的 /home4/public_html/account/required_files/page-count.php 中没有这样的文件或目录
致命错误:require_once():无法在 /home4/public_html/account/required_files/page-count 中打开所需的 'php/page-count' (include_path='.:/opt/php55/lib/php')。 php 在第 40 行
主文件是我试图在其中包含文件 page-count.php 文件的文件。
有谁知道发生了什么以及为什么这不起作用?
在required_files 文件夹中:
【问题讨论】:
-
您为
account或public_html显示的文件夹列表? -
@wogsland 这是给
account的。 -
我知道我似乎仍在呼吁
php/post-count.php,但我不是,这就是我如此困惑的原因。 -
page-count.php第 40 行有什么内容? -
@wogsland 现在它是被注释掉的代码行。不知道为什么它正在阅读它。
//require_once ("required_files/page-count.php");。我未注释的行是include_once("required_files/page-count.php");.......我在页面上的任何地方都没有php/post-count.php,甚至没有注释掉。
标签: php apache include require-once