下載安裝yii框架之后
第一件事情,配置一個(gè)密鑰
第二件事,初始url模式:?http://localhost/yii2/web/index.php/?r=hello/index,而我們習(xí)慣的模式是http://localhost/yii2/web/index.php/hello/index
重寫URL非常簡單打開config下下的web.php?在‘components’?配置項(xiàng)里加入下面的代碼
'urlManager' => [ //設(shè)置pathinfo模式 'enablePrettyUrl' => true,
? ? ? ? ? ? 'showScriptName' => false,
? ? ? ? ? ? 'rules' => [
? ? ? ? ? ? ],
? ],