What is reverse routing?

孤街醉人 提交于 2020-07-17 08:04:11

问题


Really, it's mentioned everywhere but there is even no wikipedia page named exactly that. Is this just a fancy name for URL redirecting? Does it have another name or definition?


回答1:


Reverse routing is the process of generating the URL that would lead to a route, given a symbolic reference to the route (could be name of the route/view/controller or a reference to the controller, depending on the framework).

(This is "reverse routing" because it's the opposite of normal routing or forward routing, which maps from a URL to a route specifying the view or controller.)

Examples for various frameworks:

  • Django has the url template tag and the urlresolvers.reverse helper method
  • flask has url_for
  • Rails has link_to


来源:https://stackoverflow.com/questions/19549805/what-is-reverse-routing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!