E
E
Evgeny Startsev2018-04-12 00:25:16
Yii
Evgeny Startsev, 2018-04-12 00:25:16

How to pass url as a parameter in Yii2?

Hello
The situation is this: there is a site in which a bunch of pages of the 1st, 2nd, 3rd level and all the pages are in the database.
Therefore, you need to get the full url and pass it to the controller as a parameter
Question: how to do this on yii2 (search for special results did not give)
PS You can use $_SERVER['REQUEST_URI'] - parse in the controller, but maybe there is a more adequate option?
Thanks in advance

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2018-04-12
@jey_val_star

Maybe this will suit you:

[
    'catchAll' => 'site/index',
];

And then play with
But it seems to me that you approached the problem from the wrong side. But I can not give sensible advice on the available information. Do you need to understand if there is another logic? What urls are in this database, how deep is nesting, etc.
Perhaps in general it is worth sorting out the base and bringing it to another more adequate form.

D
Dmitry, 2018-04-12
@slo_nik

Goodnight.
Parsing and generating URLs

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question