admin管理员组文章数量:1794759
flask html 下一页 第几页,flask在不同的html页面中怎样传递参数?
通过把 URL 的一部分标记为 就可以在 URL 中添加变量。
标记的 部分会作为关键字html style="color:#2aa0ea" target=_blank class=infotextkey>参数传递给函数。通过使用 ,可以选择性的加上一个转换器,为变量指定规则。@app.route('/user/')def show_user_profile(username): # show the user profile for that user
return 'User %s' % username
@app.route('/post/')def show_post(post_id): # show the post with the given id, the id is an integer
return 'Post %d' % post_id
转换器有:
int 接受整数
float 接受浮点数
path 和缺省情况相同,但也接受斜杠
URL 构建是通过 url_for() 函数来操作的。具体的可以看下:《flask快速上手》
版权声明:本文标题:flask html 下一页 第几页,flask在不同的html页面中怎样传递参数? 内容由林淑君副主任自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.xiehuijuan.com/baike/1686996212a126753.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论