在yii框架中,设置默认controller
在/protected/config/main.php添加配置
<?php return array( 'name'=>'Auto', 'defaultController'=>'auto',
上述配置了默认的controller为AutoController.php
在yii框架中,设置默认action
在AutoController.php中设置
class AutoController extends CController { public $defaultAction = 'test'; public function actionTest() { }
此时访问xxxx/index.php,会默认转到xxxx/index.php?r=auto/test,表示设置成功。
相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!
推荐阅读:
以上就是yii框架配置controller与action步骤详解的详细内容,更多请关注php中文网其它相关文章!
![php中文网最新课程二维码](/static/images/article_wechat2021.jpg?1111)
声明:本文原创发布php中文网,转载请注明出处,感谢您的尊重!如有疑问,请联系admin@php.cn处理
网友评论
文明上网理性发言,请遵守 新闻评论服务协议
我要评论