【发布时间】:2011-04-24 19:29:46
【问题描述】:
我的脚本...
index.php
DEFINE('DIR', 'http://www.example.com');
DEFINE('IN_PAGE', TRUE);
INCLUDE DIR . ('/incl/header.php');
INCLUDE DIR . ('/incl/content.php');
INCLUDE DIR . ('/incl/footer.php');
/incl/header.php
if (!defined('IN_PAGE'))
{
header("Status: 403 Forbidden");
exit('<B>403 Forbidden</B>');
}
访问 index.php
警告: 包括(http://www.example.com/incl/header.php) [function.include]:打开失败 流:HTTP 请求失败! HTTP/1.1 403 禁入 /public_html/incl/index-incl.php 在第 4 行
警告:include() [function.include]: 打开失败 'http://www.example.com/incl/header.php' 纳入 (include_path='.:/usr/lib64/php:/usr/lib/php') 在 /public_html/incl/index-incl.php 在第 4 行
它有点工作,如果我尝试直接访问该文件,我会收到我想要的“禁止”消息。但我不能将它包含在我的脚本中。即使我很确定我正确地遵循了 phpBB 的开发 wiki .
我是该死的新手,非常感谢您的帮助! =]
【问题讨论】:
-
最好的方法是将包含文件放在文档根目录之外,或者将服务器配置为不在它们所在的目录中执行脚本。
-
“我的脚本中不能包含它”是什么意思?以什么方式?