Routing in php vs routing in rails..

Posted by piemesons on Stack Overflow See other posts from Stack Overflow or by piemesons
Published on 2010-04-23T08:23:26Z Indexed on 2010/04/23 8:33 UTC
Read the original article Hit count: 773

Filed under:
|
|
|

I was working on php from past 1 yr and now a days i m learning rails.

In rails:-- Routing takes an incoming URL and decodes it into a set of parameters that are used by Rails to dispatch to the appropriate controller and action

for example

 rs.recognize_path "/blog/show/123"
 {:controller=>"blog", :action=>"show", :id=>"123"}

M i right??

We mention this (written down) line of code in our routes.rb under config directory to tell rails how to handle the request like "/blog/show/123" using this line of code.

map.connect "blog/show/:id", :controller => "blog", :action => "show", :id => /\d+/

Fine..

Now in php when we do something like this

www.xxx.com/profile.php?profile_id=2

How the request is sent to the requested page. Means i never wrote anything for routing in php, then how this request has been handled. How the rounting is done in php (anything i missed during my learning/working in php) R u getting what i am asking. Please let me know if there is any problem.

© Stack Overflow or respective owner

Related posts about routing

Related posts about php