开发者

Symfony routing: adding sf_method [get] requirement

I'm reading the book Practical Symfony, and there is a part in the book which suggests adding sf_method: [get] to routing.yml for pages which contain single job description.

My question is somewhat general: should i always add the requirement

sf_method: [get]
开发者_Go百科

to routes linking to a description of a particular object (in this case job)?

And the reason behind adding this line is primarily security, or are there more reasons?


It's unneccessary. Routes linking to a single object (assumung you're using sfDoctrineRoute or sfPropelRoute) only have get as a requirement by default. If you want to post to that url, for example, you need to explicity add [get, post] as the sf_method requirement.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜