开发者

routing in zend framework

can anyo开发者_JAVA技巧ne tell me when it is better to use routing in zend framework?


All Zend Framework web applications use 'routing.' Even at it's most basic, default setup.

You don't really have much choice as to whether or not to use routing. You do have a choice as to how the routing is constructed and how your URLs will look.

Is it better to use custom routing to have "pretty" URLs? It's an opinion, but I say yes. Custom routes can change ugly things like this:

http://yoursite.com/Users/index/view/id/199

to something 'pretty' like this:

http://yoursite/user/joe

Getting into details as to how to do this can be found in many, many other questions here. Just search for Zend Framework Routing.


Routing can be seen as 'mapping the url to an action of your program'. So as soon as you can specifiy rules how you want urls to be mapped to your programmc-code, you can use routers.
If you use the FrontController you already do use routing (with the default-route at least) as they routers do tell the dispatcher what part of your program to call (they map the url to an module/controller/action).

This is of course very general, for any further answer you might have to go into details ;)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜