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

How to modify the default homepage of yii2.0 framework

Release: 2020-01-15 10:50:15
Original
3405 people have browsed it

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)
],
],
Copy after login

2. Method 2

(1) Add in the return array under the configuration file:

‘defaultRoute’=>’default’,
Copy after login

(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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template