Home  >  Article  >  Backend Development  >  Yii framework configuration default controller and action example_PHP tutorial

Yii framework configuration default controller and action example_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:31:35818browse

Set default controller

Add configuration in /protected/config/main.php

Copy code The code is as follows:

return array(
'name'=> ;'Auto',
'defaultController'=>'auto',

The default controller configured above is AutoController.php

Set default action

Set in AutoController.php

Copy code The code is as follows:

class AutoController extends CController
{
public $defaultAction = 'test' ;

public function actionTest()
{
...
}
...

At this time, accessing xxxx/index.php will by default go to xxxx/index.php?r=auto/test

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/763013.htmlTechArticleSet the default controller. Add the configuration in /protected/config/main.php and copy the code. The code is as follows: ?php return array( 'name'='Auto', 'defaultController'='auto', the above configures the default co...
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