这个问题在这里已有答案:
我使用POST方法提交表单。 Form有一个输入字段:time
。
我试着检查是否存在参数:
if 'time' in request.data:
pass
但它不起作用
如果您将数据作为常规POST正文查询发布,则应使用request.form
,即:
@app.route('/schedule/<int:adv_id>', methods=['POST'])
def schedule(adv_id):
if "time" in request.form:
pass # do whatever you want with it