Reputation: 21
I have urlManager like this in web.php
'urlManager' =>
[
//'class' => 'yii/web/UrlManager',
'enablePrettyUrl' => true,
'showScriptName' => false,
'enableStrictParsing' => false,
'rules' =>
[
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
],
],
I just wanna know, why if I uncomment 'class' => 'yii/web/UrlManager', will cause error when I run my website.
Thank You so much
Upvotes: 0
Views: 367
Reputation: 1175
Your Class
path from
Url manager
is not correct. Yii
work with namespace and to use namespace always use backslash \
instead of front slash /
. So your code should be in following format:
'class' => 'yii\web\urlManager',
Instead of
'class' => 'yii/web/UrlManager',
Upvotes: 2
Reputation: 2258
UrlManager path is wrong. why because this should be like namespace.
yii/web/UrlManager
instead of this, try this.
yii\web\UrlManager
Note:- it's back slash not front slash.
Upvotes: 1