How to configure the default controller and action in the yii framework
This article introduces the method of configuring the default controller and action in the yii framework, and shares an example of setting the default controller and action. Learn yii My friends can refer to it, I personally think it’s pretty good.
In the Yii framework, set the default controller and add configuration in /protected/config/main.php. The specific code is as follows:
<?php
return array(
'name'=>'Auto',
'defaultController'=>'auto',
......
The default controller configured above is AutoController.php
In the Yii framework, set the default action in the AutoController.php just defined. The specific code is as follows:
<?php
class AutoController extends CController{
public $defaultAction='test';
public function actionTest(){
...
}
...
When you access xxxx/index.php at this time, you will be redirected to xxxx/index.php?r=auto/test by default, indicating that the setting is successful.
Articles you may be interested in
- Web page cache control Cache-control common values are private, no-cache, max-age, must-revalidate Introduction
- Detailed analysis of the directory structure of the yii framework
- PHP’s functions urlencode(), urldecode(), rawurlencode(), rawurldecode() to solve URL encoding problems Knowledge Summary
- Windows cannot start this hardware device because its configuration information (in the registry) is incomplete or corrupted. (Code 19) Solution
- php prompts Call to undefined function curl_init() Wrong solution
- jquery operates cookies, jquery reads cookies, jquery sets cookies, jquery deletes cookies
- How to remove the index.php string in the website URL developed by codeIgniter
-
http://www.bkjia.com/PHPjc/986788.html
www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/986788.htmlTechArticleHow to configure the default controller and action in the yii framework. This article introduces the method of configuring the default controller and action in the yii framework. Share one For examples of setting the default controller and action, you can learn...
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