H!
我正在尝试做一个简单的登录和注销方法,flash()
当你这样做时会向你打招呼。但由于某种原因,当我尝试注销并使用闪存时, session.pop() 什么也没做。
@app.route("/logout")
def logout():
session.pop("_usern", None) #For some reason I don't understand it does not pop _usern if I use flash.
flash("Goodbye!", 'info')
return redirect(url_for("index"))
我确实注意到在使用 flash() 之后,调试器返回<FileSystemSession {'_flashes': [('info', 'Goodbye!')]}>
而不是<FileSystemSession {'_usern': '******'}>
session.pop() 中的值