


How to configure the default controller and action in the yii framework_PHP tutorial
Jul 13, 2016 am 09:56 AMHow 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

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to solve the problem that SpringBoot cannot scan the Controller

DJI Osmo Action 5 Pro: Release date mooted as retailer reveals launch pricing that could undercut GoPro Hero 13 Black

How to add URL prefix to SpringBoot multiple controllers

How to use PHP framework Yii to develop a highly available cloud backup system

Yii2 vs Phalcon: Which framework is better for developing graphics rendering applications?

Symfony vs Yii2: Which framework is better for developing large-scale web applications?

Data query in Yii framework: access data efficiently
