flask表单post传数据

来源:互联网 发布:linux vim u撤销不了 编辑:程序博客网 时间:2024/05/24 07:40
最简单的方法
flask run.py加入

@app.route('/custom', methods=['GET', 'POST'])def custom():    if request.method == 'POST':        time = request.form.get('time')        ...


templates里的页面加
<form method="POST" action="{{ url_for('custom') }}">    <input type="text" name="time" class="time-input" placeholder="example: 12/30s/20m/2h">    <input type="submit" class="startButton" value="START"></form>


原创粉丝点击