Home >PHP Framework >YII >How to modify the default homepage of yii2.0 framework

How to modify the default homepage of yii2.0 framework

尚
Original
2020-01-11 16:06:473417browse

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

How to modify the default homepage of yii2.0 framework

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn