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' => [
            ],
        ],
    ],
];

猜你喜欢

转载自www.cnblogs.com/hopelooking/p/10130984.html