Answer the question
In order to leave comments, you need to log in
How to do multilevel routing correctly?
Hello! Completely confused with routing, kick in the right direction.
I'm trying to make pages:
'user/(?P<user_id>[0-9]+)(/(?P<action>[a-z_-]+))?' => [
'controller' => 'user'
];
Answer the question
In order to leave comments, you need to log in
Discover the HTTP methods (get/post/put/delete/patch) - they were invented for a reason.
For ease of solution, take the form CLASS/param/param/param
/user/234 - user's page
/user/234 - similar to the previous
albums/user/234/ - user's albums page 234
albums/567 - user's specific album (if album numbers are cross-cutting)
albums/234/6 - if you need two user-num fields
But what to do - let it specify the HTTP method (get/put/delete)
Well, or CLASS/METHOD/param/param/param
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question