D
D
darknet372017-03-06 04:29:59
Yii
darknet37, 2017-03-06 04:29:59

Working with routes in Yii2?

I deduce categories from the database, and make the CNC link an alias (just by the field in the database).
5996d776e2564a0a90e9bd7203e305fa.png
With the help of routes, I make a beautiful link:
Route: , The resulting type of link: mysite.ru/tkani But why doesn't it work with the "postelnoe-bele" link, if I remove the hyphen, the link becomes normal. Tell me what's the problem? '<alias:\w+>' => 'category/view'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Ne-Lexa, 2017-03-06
@darknet37

You have a regular expression in your aliases, and \w matches any alphanumeric character.
Accordingly, you need to correct it by adding the ability to set a dash, or remove it altogether, leaving only <alias>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question