Answer the question
In order to leave comments, you need to log in
How to make a router yourself?
Good day, I'm trying to make a router myself.
it turned out to be implemented by direct coincidence of the router, for example, news/all
but I had a problem how to implement news/88/edit
Google tried, I strained the convolutions, but nothing. All I managed to come up with is that the route should be written in this form news/{id:\d}/edit
and it needs to be translated into a regular expression and the url must be checked for a match in the regular expression.
Can you tell me how to translate it news/{id:\d}/edit
into a regular expression?
Answer the question
In order to leave comments, you need to log in
https://www.php.net/manual/ru/function.parse-url.php
Parse and see what is what and decide what to do with it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question