"Webpage has expired" $_SESSIONS in PHP
In my web-application I'm using $_SESSIONS
but sometimes, when the users hits the backspace key he gets:
Webpage has expired
message.
Why is this happening? What can i do to avoid this?
如果你对这篇文章有疑问,欢迎到本站 社区 发帖提问或使用手Q扫描下方二维码加群参与讨论,获取更多帮助。

评论(3)

Like Chad said, that's the result of going back to a page that was the result of a POST request. And like the comments said, you can't just replace a POST with a GET, because that's a bad idea for a variety of reasons.
However, you can combine the two: let the request be a POST, but issue a Location header redirect, which the browser will then execute as a GET. To the user this will look like a single operation, but to the browser it will be a POST followed by a GET, which effectively eliminates this issue.

It also has to do with the cache control directives sent to the browser.
Take a look at http://de.php.net/manual/en/session.configuration.php and http://shiflett.org/articles/how-to-avoid-page-has-expired-warnings to learn more about the cache settings.
http://shiflett.org/articles/how-to-avoid-page-has-expired-warnings:
Recap
To avoid "Page Has Expired" warnings, set session.cache_limiter to private, and make sure that any form using the POST method submits to an intermediate processing page that redirects the user to a different URL.
发布评论
需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。