随笔分类 -  Yii2

摘要:可以在配置文件中增加一个 “beforeRequest” 事件: 参考资料:stack overflow 阅读全文
posted @ 2016-04-28 17:24 yikai.shao 阅读(325) 评论(0) 推荐(0)
摘要:示例控制器: 阅读全文
posted @ 2016-04-14 11:12 yikai.shao 阅读(6387) 评论(0) 推荐(0)
摘要:参考资料:http://www.bsourcecode.com/yiiframework2/how-to-create-custom-widget-in-yii2-0-framework/如何使用yii2框架自定义widget本教程教你如何自定义widget,widget是view中能被重用的代码块... 阅读全文
posted @ 2015-12-26 16:41 yikai.shao 阅读(2284) 评论(0) 推荐(0)
摘要:使用方法// scenario is set as a property$model = new User;$model->scenario = User::SCENARIO_SHOW;// scenario is set through configuration$model = new User... 阅读全文
posted @ 2015-12-02 10:25 yikai.shao 阅读(639) 评论(0) 推荐(0)
摘要:Role Based Access Control (RBAC)——基于角色的权限控制permissione.g. creating posts, updating postsroleA role represents a collection of permissions (e.g. creati... 阅读全文
posted @ 2015-08-26 09:49 yikai.shao 阅读(889) 评论(0) 推荐(0)
摘要:直接上代码:$db = Yii::$app->db;$transaction = $db->beginTransaction(); //开启事务try { // 更新member表 $db->createCommand()->update('member',[ 'level' ... 阅读全文
posted @ 2015-05-29 14:21 yikai.shao 阅读(473) 评论(0) 推荐(0)