Yii2框架配置pathinfo模式访问

在main-local.php中进行如下配置:

'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules' => [
            ],
        ],

添加位置如下:

$config = [
    'components' => [
        'request' => [
            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
            'cookieValidationKey' => '109iZct4Y1DmRdKTazdkvqWh1mAZVVVA',
        ],
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules' => [
            ],
        ],
    ],
];
通往牛逼的路上,在意的只有远方!
原文地址:https://www.cnblogs.com/jiangshiguo/p/10130984.html