Home >PHP Framework >YII >How to modify the default homepage of yii2.0 framework
Yii2.0 framework method to modify the default homepage:
1. Method 1:
Modify under the configuration file main.php:
‘urlManager’ => [ ‘enablePrettyUrl’ => true, ‘showScriptName’ => false, ‘suffix’ => ‘.html’, //这个字段表示后缀 ‘rules’ => [ ‘/’ => ‘default/index’, //设置默认首页 (修改默认首页方法1) ], ],
2. Method 2
(1) Add in the return array under the configuration file:
‘defaultRoute’=>’default’,
(2) Create a Default controller and Index method
Recommended learning: Yii introductory tutorial
The above is the detailed content of How to modify the default homepage of yii2.0 framework. For more information, please follow other related articles on the PHP Chinese website!