【发布时间】:2011-06-27 23:06:24
【问题描述】:
Index.php -> 包括 init.php init.php -> 包括 config.php config.php -> 包含配置
问题不是我能够从 config.php 访问内容到 index.php,但是当我尝试从 init.php 或 index.php 访问数据到 config.php 时,它没有发生。
如果我在 config.php 中输入 echo "i am text" 并运行 index.php,那么屏幕上不会显示任何内容,但是当我运行 "echo $item_from_config_file" 时,它会输出 config.php 中设置的数据
请帮助并提出解决此问题的方法,因为它让我发疯。
【问题讨论】:
-
使用 require() 并在 php.ini 中开启错误报告。
-
我们能看到你的代码+其中的路径吗?
-
使用 require() 的结果仍然相同
-
include.php => //包含初始化文件 require "init.php"; init.php => //包含配置文件 require "lib/config.php"; cofig.php => define("SITE_URL", "example.com/");
-
@user381695,请使用常见问题解答如果您不确定如何编辑您的帖子,以及最佳实践是什么,我们无法在没有代码的情况下为您提供帮助! - 程序员不是魔术师吗
标签: php apache file filesystems include