简体   繁体   English

Flask Web开发通过app.route传递多个变量

[英]Flask web developments passing multiple variables thru app.route

what im trying to do today is to pass multiple variables thru links to flask or just additional symbols followed by url i have tried this 我今天想要做的是通过链接传递到烧瓶的多个变量或URL后面的其他符号,我已经尝试过了

@app.route('/?action='+'<cmd>')

or 要么

@app.route('/?<cmd>')

both give me a 404 error 都给我一个404错误

but when i remove the "?" 但是当我删除“?” symbol it works fine. 象征它工作正常。 Any ideas? 有任何想法吗?

If you want to get query string parameter values the best way is to do this in your @app.route function. 如果要获取查询字符串参数值,最好的方法是在@app.route函数中执行此@app.route For example, getting the action query string parameter: 例如,获取action查询字符串参数:

@app.route('/')
def index():
    action = request.args.get('action')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM