How to configure the default controller and action in the yii framework_PHP tutorial

WBOY
Release: 2016-07-13 09:56:41
Original
876 people have browsed it

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',
	......
Copy after login

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(){
        ...
    }
    ...
Copy after login

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

truehttp: //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...
Related labels:
source:php.cn
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!