How to configure the default controller and action in the yii framework

Source: Internet
Author: User

How to configure the default controller and action in the yii framework

This article describes how to configure the default controller and action in the yii framework, and shares an example of setting the default controller and action. If you are a friend of yii, you can refer to the example.

In the yii framework, set the default controller to add configuration in/protected/config/main. php. The specific code is as follows:

<?phpreturn array('name'=>'Auto','defaultController'=>'auto',......

The default controller is AutoController. php.

In the yii framework, set the default action in the AutoController. php file just defined. The specific code is as follows:

<?phpclass AutoController extends CController{    public $defaultAction='test';    public function actionTest(){        ...    }    ...

When xxxx/index. php is accessed, it is forwarded to xxxx/index. php by default? R = auto/test, indicating that the setting is successful.

Articles you may be interested in
  • Common Values of Cache-control include private, no-cache, max-age, and must-revalidate.
  • Detailed analysis on the directory structure of the yii framework
  • URL encoding functions such as urlencode (), urldecode (), rawurlencode (), and rawurldecode ()
  • Yii framework cache knowledge Summary
  • Windows cannot start the hardware device because its configuration information (in the Registry) is incomplete or damaged. (Code 19) Solution
  • Php prompts Call to undefined function curl_init () Error Solution
  • Jquery operation cookie, jquery reading cookie, jquery setting cookie, jquery deleting cookie
  • How to remove the index. php string from the website url developed by codeIgniter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.