【问题标题】:Show different content after page refresh页面刷新后显示不同的内容
【发布时间】:2011-07-02 12:36:03
【问题描述】:

.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,是否有任何解决方法来清除引荐来源帖子数据或检测第一个页面加载(可能创建一个隐藏字段并在第二个页面加载时检测其值)?

【问题讨论】:

    标签: php cache-control hidden-field referer


    【解决方案1】:
    if (!isset($_SESSION['pageload'])) {
    $_SESSION['pageload'] = "true";
    header("Location:somepage.php");
    } else {
    unset($_SESSION['pageload']);
    }
    

    【讨论】:

    • 我不想使用 cookie,我想知道如何使用隐藏字段检测首页加载或检测帖子数据?
    猜你喜欢
    • 2023-03-08
    • 2019-02-11
    • 2012-01-30
    • 1970-01-01
    • 2019-08-13
    • 2014-04-18
    • 1970-01-01
    • 2023-03-26
    • 2015-07-29
    相关资源
    最近更新 更多