1 @app.route(‘/‘) 2 def index(): 3 flash(‘33333‘) 4 flash(‘44444‘) 5 flash(‘55555‘) 6 flash(‘66666‘) 7 if ‘username‘ in session: 8 return render_template(‘test.html‘) 9 10 return render_template(‘test.html‘)
// test.html1 <body> 2 {% with messages = get_flashed_messages() %} 3 {% for message in messages %} 4 {{ message }} 5 {% endfor %} 6 {% endwith %} 7 </body>
原文地址:https://www.cnblogs.com/yugengde/p/8245430.html
时间: 2024-10-09 04:08:24