M
M
maks789452020-04-27 22:39:52
PHP
maks78945, 2020-04-27 22:39:52

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}/editand 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}/editinto a regular expression?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
profesor08, 2020-04-27
@maks78945

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 question

Ask a Question

731 491 924 answers to any question