M
M
Mikhail Bazhenov2014-06-23 18:08:55
Yii
Mikhail Bazhenov, 2014-06-23 18:08:55

How to handle such routes in Yii2?

Hey!
How to handle such requests ' site.ru/products/* ' so that ' site.ru/products/phones/touch ' is also taken into account The rule
'/products/*' => 'category/view' does not work

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2014-06-23
@benign

Apparently the same as in 1.1.

function actionView($path) {
    // это пример. Все зависит от архитектуры
    $category = Category::findByPath($path);
}

Also, if you want everything to be more competent, implement the rule as an instance of the UrlRule class.

L
LAV45, 2014-07-01
@LAV45

'/products/*'
where did you see such preg_match?
'/products/.*'- I think it should work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question