The following is a summary of the related configuration of Yii:
Configuration in 1,/protected/config/main.php:
1) Modify the default controller, download the source code default controler for Sitecontroller:
In protected/config/main.php, the value of the modifier key Defaultcontroller is the specified controller, and the default action must be specified in the controller. Use Defaultcontroller/defaultaction to respond when the request is not explicitly intended.
' Defaultcontroller ' => ' main ',
After setting up access to the site root path, you can jump to the corresponding Controller:MainController.php
Download the source code defaults to site, is specified in the yiilite.php file, in the example to jump to sitecontroller.php
2) Modify the default login action:
When the unknown login page, when not logged in to access the page that needs to be logged in, Yii jumps to the default login action and the default action is Site/login, which can also be customized in the main.php or module configuration file
' Components ' =>array (
' User ' =>array (
' Allowautologin ' =>true,
' Loginurl ' =>array (' main/login.html '),
),
...
3 The definition of database connection:
' DB ' =>array (
' connectionString ' => ' Mysql:host=localhost;dbname=db_schema ',
' Emulateprepare ' => true,
' username ' => ' root ',
' Password ' => ' 123 ',
' CharSet ' => ' UTF8 ',
' Tableprefix ' => ' zz_ ',
),
4 The default error action definition, which is invoked when an error occurs:
' ErrorHandler ' =>array (
' ErrorAction ' => ' main/error ',
),
5) Adding modules:
' Modules ' =>array (
...,//other modules
' Admin ',
),
You can access it by path after adding it:
Http://127.0.0.1:8080/zuizen/index.php?r=admin/default
Or:
http://127.0.0.1:8080/zuizen/admin/If the access path is modified by the previous section