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

2015-01-24信息快讯网

这篇文章主要介绍了yii框架配置默认controller和action示例,需要的朋友可以参考下

设置默认controller

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

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

PHP中魔术变量__METHOD__与__FUNCTION__的区别
php中json_encode UTF-8中文乱码的更好解决方法
PHP错误Warning: Cannot modify header information - headers already sent by解决方法
PHP会话控制:Session与Cookie详解
PHP中file_get_contents高用法实例
安装ImageMagick出现error while loading shared libraries的解决方法
php中file_get_content 和curl以及fopen 效率分析
CodeIgniter错误mysql_connect(): No such file or directory解决方法
当前比较流行的两款PHP加密、解密工具Zend Guard和iconCube介绍
Chrome Web App开发小结
PHP提示Deprecated: mysql_connect(): The mysql extension is deprecated的解决方法
php版本的cron定时任务执行器使用实例
phpmyadmin出现Cannot start session without errors问题解决方法
getJSON跨域SyntaxError问题分析
php分页示例分享
yii框架通过控制台命令创建定时任务示例
smarty模板中使用get、post、request、cookies、session变量的方法
php自定义session示例分享
PHP检测移动设备类mobile detection使用实例
Session的工作机制详解和安全性问题(PHP实例讲解)
PHP中Session引起的脚本阻塞问题解决办法
php警告Creating default object from empty value 问题的解决方法
PHP fopen()和 file_get_contents()应用与差异介绍
分享下页面关键字抓取components.arrow.com站点代码
PHP $_FILES中error返回值详解
linux实现php定时执行cron任务详解
解决file_get_contents无法请求https连接的方法
phpstrom使用xdebug配置方法
php file_get_contents抓取Gzip网页乱码的三种解决方法
PHP file_get_contents设置超时处理方法
php读取本地文件常用函数(fopen与file_get_contents)
yii框架源码分析之创建controller代码
©2014-2024 dbsqp.com