Table of Contents
How to configure the default controller and action in the yii framework
Articles you may be interested in
Home Backend Development PHP Tutorial How to configure the default controller and action in the yii framework_PHP tutorial

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

Jul 13, 2016 am 09:56 AM
action controller yii

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...
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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to solve the problem that SpringBoot cannot scan the Controller How to solve the problem that SpringBoot cannot scan the Controller May 14, 2023 am 08:10 AM

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 DJI Osmo Action 5 Pro: Release date mooted as retailer reveals launch pricing that could undercut GoPro Hero 13 Black Sep 04, 2024 am 06:51 AM

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 add URL prefix to SpringBoot multiple controllers May 12, 2023 pm 06:37 PM

How to add URL prefix to SpringBoot multiple controllers

How to use Yii3 framework in php? How to use Yii3 framework in php? May 31, 2023 pm 10:42 PM

How to use Yii3 framework in php?

How to use PHP framework Yii to develop a highly available cloud backup system How to use PHP framework Yii to develop a highly available cloud backup system Jun 27, 2023 am 09:04 AM

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? Yii2 vs Phalcon: Which framework is better for developing graphics rendering applications? Jun 19, 2023 am 08:09 AM

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? Symfony vs Yii2: Which framework is better for developing large-scale web applications? Jun 19, 2023 am 10:57 AM

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

Data query in Yii framework: access data efficiently Data query in Yii framework: access data efficiently Jun 21, 2023 am 11:22 AM

Data query in Yii framework: access data efficiently

See all articles