1

.php 页面检查引用者是否来自 xdomainname.com,如果是 iframe 页面 X,如果不是 iframe 页面 Y。

问题是如果刷新 .php 页面(仅在第一次加载时 iframe 页面 X/Y),我想重定向到另一个页面。

我尝试添加缓存标头,但 .php 页面仍然是 iframe 页面 X/Y - 取决于引用者。

header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
header( 'Cache-Control: no-store, no-cache, must-revalidate' );
header( 'Cache-Control: post-check=0, pre-check=0', false );
header( 'Pragma: no-cache' );

除了 cookie 之外,是否有任何解决方法来清除引荐来源帖子数据或检测第一页加载(可能创建一个隐藏字段并在第二个页面加载时检测其值)?

4

1 回答 1

1
if (!isset($_SESSION['pageload'])) {
$_SESSION['pageload'] = "true";
header("Location:somepage.php");
} else {
unset($_SESSION['pageload']);
}
于 2011-07-02T04:36:03.380 回答