更新时间:2023-02-23 22:47:03
您应该将查询参数排除在路由之外,因为它们不属于该路由。
You should leave the query parameters out of the route as they aren't part of it.
@app.route('/post', methods=['GET'])
def show_post():
post_id = request.args.get('id')
return post_id
request.args
是一个包含URL中传递的所有查询参数的字典。
request.args
is a dictionary containing all of the query parameters passed in the URL.