加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > PHP > 正文

yii框架配置默认controller和action示例

发布时间:2020-05-28 13:12:58 所属栏目:PHP 来源:互联网
导读:这篇文章主要介绍了yii框架配置默认controller和action示例,需要的朋友可以参考下

设置默认controller

在/protected/config/main.php添加配置

代码如下:return array(
'name'=>'Auto',
'defaultController'=>'auto',

上述配置了默认的controller为AutoController.php

设置默认action

在AutoController.php中设置

代码如下:class AutoController extends CController
{
public $defaultAction = 'test';

public function actionTest()
{
...
}
...

此时访问xxxx/index.php会默认转到xxxx/index.php?r=auto/test

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读