php – 后退按钮的会话问题
发布时间:2020-12-13 16:53:47 所属栏目:PHP教程 来源:网络整理
导读:我在php文件中有这个代码,它包含在我要共享的所有页面中并保护我的页面. session_name("login");session_start();if (!isset($_SESSION['UserId'])) { if(!header("Location: https://subdomain.mywebsite.com/")) { die("Unauthorized access"); }}session_
我在php文件中有这个代码,它包含在我要共享的所有页面中并保护我的页面.
session_name("login"); session_start(); if (!isset($_SESSION['UserId'])) { if(!header("Location: https://subdomain.mywebsite.com/")) { die("Unauthorized access"); } } session_regenerate_id(); $UserId = $_SESSION['UserId']; 问题是我说有一个页面 Register > Select Service > Select Payment Mode 假设在付款模式下,用户意识到他在第2页输入错误,选择服务,他按下后退按钮,由于会话的使用而发生错误. 错误是 Document Expired This document is no longer available. The requested document is not available in Firefox's cache. As a security precaution,Firefox does not automatically re-request sensitive documents. Click Try Again to re-request the document from the website. 我应该如何处理此类事件,我想使用会话来保护我的页面,但我也希望用户能够在不损害会话的情况下返回上一页. 解决方法
我把它设置在我的php页面的顶部
ini_set("session.cache_limiter","must-revalidate"); 并解决了这个问题 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |