doushang2571 2017-04-07 03:49
浏览 22

Yii2类Yii / web / UrlManager导致错误

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

  • 写回答

2条回答 默认 最新

  • duanlei0282 2017-04-07 04:47
    关注

    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.

    评论

报告相同问题?