Answer the question
In order to leave comments, you need to log in
How to set a universal CNC in Yii2?
There are URLs:
'urlManager' => [
'class' => 'yii\web\UrlManager',
'enablePrettyUrl' => true,
'showScriptName' => false,
'enableStrictParsing' => true,
'rules' => [
[
'pattern' => '',
'route' => 'site/index',
'suffix' => '',
],
[
'pattern' => 'katalog_<modul>',
'route' => 'categories/index',
'suffix' => '',
],
[
'pattern' => 'katalog_<modul>/<firstId>',
'route' => 'categories/index',
'suffix' => '',
],
[
'pattern' => 'katalog_<modul>/<firstId>/<secondId>',
'route' => 'categories/index',
'suffix' => '',
],
Answer the question
In order to leave comments, you need to log in
I solved the problem myself =)
Maybe it will be useful for someone:
'pattern' => 'katalog_<modul:(\w+)(/(\w+))?(/(\w+))?>',
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question