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

Yii framework configuration default controller and action example_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 10:31:35
Original
869 people have browsed it

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...
Related labels:
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