Home > Article > Backend Development > Detailed explanation of the steps of configuring controller and action in Yii framework
This time I will bring you the yii frameworkdetailed explanation of the steps to configure the controller and action. What are the precautions for configuring the controller and action in the yii framework? The following are Let’s take a look at practical cases.
In the yii framework, set the default controller
Add configuration in /protected/config/main.php
<?php return array( 'name'=>'Auto', 'defaultController'=>'auto',
The default controller configured above is AutoController.php
In the yii framework, set the default action
Set in AutoController.php
class AutoController extends CController { public $defaultAction = 'test'; public function actionTest() { }
When you access xxxx/index.php at this time, will it go to xxxx/index.php by default? r=auto/test means the setting is successful.
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
PHP7 uses lib library case code analysis based on function method
PHP finds the entry node in the linked list Detailed explanation of steps
The above is the detailed content of Detailed explanation of the steps of configuring controller and action in Yii framework. For more information, please follow other related articles on the PHP Chinese website!