比如我的路由是 http://localhost/basic/web/?r=site/index 现在想改成 http://localhost/basic/web/site/index 的形式 第一步 在config/web/php里把urlManager的注释打开 第二步 在basic\web目录 ...
分类:
其他好文 时间:
2017-10-04 18:29:27
阅读次数:
183
在modal使用begin的时候指定options选项的tabindex为false 2017-09-30 参考:http://www.manks.top/yii2_modal_gridview_update.html ...
分类:
其他好文 时间:
2017-09-30 13:36:24
阅读次数:
156
大王派我来巡山_site:http://blog.csdn.net/wang78699425/article/details/52369841 最近由于项目(yii2 的一个项目)需要,登录页面不需要使用布局(layout),使用单独的页面,然后我就在登录视图里面加了一行代码$this->conte ...
分类:
移动开发 时间:
2017-09-28 12:54:27
阅读次数:
484
什么是软删除 后台操作,删除一条记录,不希望真正的从数据库中删除,用个字段标记一下。比如delete_at。默认0。当执行删除操作,更新delete_at为当前时间戳 这样列表显示的时候只查询delete_at为0的记录。 牵涉到Yii2的中的操作 引入SoftDeleteBehavior文件 在需 ...
分类:
其他好文 时间:
2017-09-27 20:36:26
阅读次数:
165
由于yii2的csrf机制,如果是自己写ajax post提交方式,会提示提交数据验证错误,有两种解决方法: 1.关于controller里面的csrf验证 2.根据Yii::$app获取csrftoken; ...
分类:
Web程序 时间:
2017-09-24 18:15:47
阅读次数:
179
<input type="hidden" name="_csrf" value="<?=Yii::$app->request->csrfToken?>" />如果你添加了以上标签还是报错那么你需要坚持看完这篇文档 刚开始做Yii2开发的程序猿基本上都遇到过这个错误,因为在程序设计中避免不了的要向服务 ...
分类:
其他好文 时间:
2017-09-21 19:33:04
阅读次数:
153
1.设置 cookieValidationKey 在 config/web.php 中 config 里有 components项中request有个cookieValidationKey需要配置参数,可以填写上和项目相关的一个值。 2.Url 路由美化 初始访问方式为 project/web/in ...
分类:
其他好文 时间:
2017-09-20 19:23:32
阅读次数:
121
条件查询 $customers = Customer::find()->where($cond)->all(); $cond就是我们所谓的条件,条件的写法也根据查询数据的不同存在差异,那么如何用yii2的方式来写查询条件呢? [[简单条件]] [[and]]:将不同的条件组合在一起,用法举例: [[ ...
分类:
其他好文 时间:
2017-09-13 01:40:05
阅读次数:
106
下载uditor git clone https://github.com/BigKuCha/yii2-ueditor-widget.git 将下载的项目放到 common/wdigets目录上 修改命名空间 或者 安装 Either run or add to the require sectio ...
分类:
其他好文 时间:
2017-09-12 12:05:10
阅读次数:
184
$money_count = ShopOrders::find() ->where(['shop_user_id'=>$shop_user_id,'status'=>2,'shop_id'=>$shop_id]) ->SUM('goods_price'); ...
分类:
其他好文 时间:
2017-09-11 18:23:42
阅读次数:
162