S
S
sdgs4s4 .2017-10-20 12:42:42
Yii
sdgs4s4 ., 2017-10-20 12:42:42

UrlManager in Yii2 need help!?

index.php

<a href="<?= \yii\helpers\Url::to(['price/view', 'id' => $price->id, 'slug' => $price->slug]) ?>

urlManager
'price/<id:\d+><slug:\wd->' => 'price/view',
Output:
domain.loc/price/view?id=13&slug=translit-tovara or
domain.loc /
price/13?slug=translit-tovara -translit-goods ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Pavlenko, 2017-10-20
@Encoderast

Yes, you perfectly felt the essence of the error:
You need to do this:
Should work, check.
And to understand these d+ - refer to Google: PHP PREG-templates. Something like:
www.skillz.ru/dev/php/article-Regulyarnye_vyrazhen...
But it's better to even look for PHP tutorials

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question