【发布时间】:2011-11-30 08:56:01
【问题描述】:
我正在使用 jQuery 加载,从外部文件加载一些数据,如下所示:
$("#div1").load("test.php");
现在这工作正常,但我希望用户不能访问 test.php。如果他们输入 URL test.php,则被重定向到 index.php
我试过了:
我在我的索引中插入:<? $fromIndex = true; ?>,这在我的 test.php 文件中:
<?
$fromIndex = true;
if(!isset($fromIndex) || !$fromIndex) {
header("Location: index.php");
exit();
}
?>
如果您访问 test.php,重定向效果很好,但从 index.php 加载不起作用。
编辑:注意:我不介意将 test.php 更改为 .xml 吗?或者任何其他有帮助的东西。我正在加载的内容很少<option>的
有人可以帮帮我吗?
非常感谢
【问题讨论】: