Home > Backend Development > PHP Tutorial > YII learning to modify the default controller

YII learning to modify the default controller

WBOY
Release: 2016-07-29 08:51:14
Original
893 people have browsed it

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.

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