Home > Article > Backend Development > YII learning to modify the default controller
YII Learning to Modify the Default Controller
1. After the installation of Yii is completed, the system default is the Index controller under the site. The following is modified to the index controller under the index
Open the configuration file main.php, in the first array Inside, add 'defaultController'=>'Index', and that's it
2. Each controller can also set the default access method. Just add it under the class
public $defaultAction = 'index';
3, loading template method
$this->render("index"); // Will load the default layout and output the client script
$this->renderPartial(" index") ;// No will load the default layout By default, the client script will not be automatically rendered and output. You need to specify parameters before it will be output
renderPartial($view,$data=null,$return= false,$processOutput=false)
Just specify processOutput as true.
The above introduces YII learning to modify the default controller, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.