http://docs.jinkan.org/docs/flask/quickstart.html#routing
在route規則中可以這樣寫
網頁url/user/username 這個username的字會被username變數接收
所以打入url/user/malo --> username就會是malo
另一種寫法,把post_id轉為int型態
<converter:variable_name>
中文的資料只有說3種converter
但在這邊,寫了好幾個converter
http://flask.pocoo.org/docs/0.11/quickstart/#variable-rules
string和path主要分別在於path可以包含slash
The following converters exist:
string | accepts any text without a slash (the default) |
int | accepts integers |
float | like int but for floating point values |
path | like the default but also accepts slashes |
any | matches one of the items provided |
uuid | accepts UUID strings |
沒有留言:
張貼留言