我试图在python webpy框架中构建一个网站,但我在web浏览器的缓存控制方面遇到了问题。当用户按下浏览器的后退按钮时,即使用户已注销,也会返回用户页面。
我的代码看起来像这样-它有错误,但我不确定它是如何完成的
class Logout: web.header("Cache-Control", "no-cache, max-age=0, must-revalidate, no-store") def GET(self): session.login=0 session.kill() raise web.seeother('/')
任何帮助都将不胜感激。 我实际上在寻找python代码,因为我不知道“web.header”应该放在哪里。
你把你的网。类的实际GET和SET方法中的头指令。
因此,您的案例是:
class Logout: def GET(self): web.header("Cache-Control", "no-cache, max-age=0, must-revalidate, no-store") session.login=0 session.kill() raise web.seeother('/')