随笔分类 -  YII2

摘要:png分为png-8、png-24、png-32 当使用imagepng、imagejpeg输出含有PNG-8图片时通道会消失,png-24图片不会发生这个问题; 应该为避免这种情况,应该先把png-8的图片转换成jpg形式,这样颜色通道就能保存下来; 合成: pubilc function Com 阅读全文
posted @ 2021-01-21 11:44 百事可口 阅读(811) 评论(0) 推荐(0)
摘要:$list = Cash::find()->alias('c')->select([ 'sum(case when c.status = 0 then 1 else 0 end) count_1', 'sum(case when c.status = 1 then 1 else 0 end) cou 阅读全文
posted @ 2020-12-23 19:47 百事可口
摘要:eg:goods数据字段id | name 新增 type 指定固定值 区分来自不同goods$goods1 = Goods::find()->select('id','name') ->addSelect(new Expression("0 as type")) $goods2 = Goods:: 阅读全文
posted @ 2020-08-24 16:00 百事可口 阅读(367) 评论(0) 推荐(0)
摘要:$query1 = Class1::find()->where($where); $query2 = Class1::find()->alias('a')->join('left join', Class2::tableName() . 'as b', 'b.id = a.objId') ->sel 阅读全文
posted @ 2020-08-20 14:07 百事可口 阅读(746) 评论(0) 推荐(0)
摘要:https://www.cnblogs.com/dwj97/p/6632848.html 设置定时任务 linux下,运行crontab -e 30 21 * * * /usr/local/php/bin/php /your_project_path/yii test/test //应用程序 上面的 阅读全文
posted @ 2019-06-15 17:37 百事可口 阅读(186) 评论(0) 推荐(0)
摘要:https://laravelcode.cn/posts/8/yii20-restful-api-basic-configuration-tutorial 阅读全文
posted @ 2019-04-23 18:33 百事可口 阅读(95) 评论(0) 推荐(0)
摘要:一般创建 https://www.cnblogs.com/grimm/p/5773169.html 管理后台 一、结合proc_open 转 https://www.yiichina.com/tutorial/1655 更新CronParser类:https://gitee.com/jianglib 阅读全文
posted @ 2019-04-22 15:09 百事可口 阅读(223) 评论(0) 推荐(0)
摘要:这里说一下关于使用数据库事务几项功能的改进。 首先,你现在可以像下面这样以回调形式的事务工作: $connection->transaction(function(){ $order = new Order($customer); $order->save(); $order->addItems($ 阅读全文
posted @ 2019-04-09 09:59 百事可口 阅读(136) 评论(0) 推荐(0)
摘要:https://www.jb51.net/article/88562.htm 本文实例讲述了Yii+MYSQL锁表防止并发情况下重复数据的方法。分享给大家供大家参考,具体如下: lock table 读锁定 如果一个线程获得在一个表上的read锁,那么该线程和所有其他线程只能从表中读数据,不能进行任 阅读全文
posted @ 2019-04-07 09:17 百事可口 阅读(595) 评论(0) 推荐(0)
摘要:http://www.digpage.com/lock.html 阅读全文
posted @ 2019-04-03 15:13 百事可口 阅读(171) 评论(0) 推荐(0)
摘要:幻读 幻读是指当事务不是独立执行时发生的一种现象。 幻读 幻读是指当事务不是独立执行时发生的一种现象。 事务A读取与搜索条件相匹配的若干行。事务B以插入或删除行等方式来修改事务A的结果集,然后再提交。 幻读是指当事务不是独立执行时发生的一种现象,例如第一个事务对一个表中的数据进行了修改,比如这种修改 阅读全文
posted @ 2019-04-03 14:40 百事可口 阅读(271) 评论(0) 推荐(0)
摘要:class ExecuteHelper { /** * @param string $classPath 实例化类名路径 * @param string $method 方法 * @param array $params 参数 * @throws NotFoundHttpException */ public static fun... 阅读全文
posted @ 2019-03-28 11:15 百事可口 阅读(118) 评论(0) 推荐(0)
摘要:unique、exist等无法使用客户端验证 可使用ajax验证 https://www.cnblogs.com/wujuntian/p/7265781.html 阅读全文
posted @ 2019-03-27 15:28 百事可口 阅读(117) 评论(0) 推荐(0)
摘要:一对多 a表 id status 1 1 b表 id income aid 1 1000 1 2 2000 1 3 3000 1 若b表有数据查询 a表展示出 b表income和 阅读全文
posted @ 2019-01-12 17:20 百事可口 阅读(1042) 评论(0) 推荐(0)
摘要:扩展 1. 2amigos/qrcode-library https://qrcode-library.readthedocs.io/en/latest 直接调用 2.phpqrcode http://phpqrcode.sourceforge.net/ 阅读全文
posted @ 2018-12-26 11:33 百事可口 阅读(526) 评论(0) 推荐(0)
摘要:转载 先确保 Topic 有 getComments() 方法 joinWith() with() 而针对于这两者,官网上是这样说的: yii\db\ActiveQuery::joinWith() 和 yii\db\ActiveQuery::with() 的区别是 前者连接主模型类和关联模型类的数据 阅读全文
posted @ 2018-11-17 16:12 百事可口 阅读(6490) 评论(0) 推荐(0)
摘要:转https://www.cnblogs.com/skybreak/p/6137035.html 在Bootstrap中的Modal,select2插件会有不显示,因为其z-index小于modal,还有另外一个问题是,修正z-index之后,select2不会自动失去焦点的问题。代码解决如下: 因 阅读全文
posted @ 2018-11-16 10:23 百事可口 阅读(690) 评论(0) 推荐(0)
摘要:统一修改 $form = ActiveForm::begin([ 'fieldConfig' => [ 'options'=>['class' => 'weui-cell weui-cell_access'],//修改 {label} 上一层样式 'template' => "<div class= 阅读全文
posted @ 2018-11-15 15:13 百事可口 阅读(399) 评论(0) 推荐(0)
摘要:本文版权归作者,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。 yii2的一个强大之处之一就是他的Form组件,既方便又安全。有些小伙伴感觉用yii一段时间了,好嘛,除了比tp"难懂"好像啥都没有。 领导安排搞一个注册的功能,这家伙刷刷刷的又 阅读全文
posted @ 2018-11-06 10:15 百事可口 阅读(534) 评论(0) 推荐(0)
摘要:视图间共享数据view component视图组件提供params 参数属性来让不同视图共享数据。 例如在about视图中, 可使用如下代码指定当前breadcrumbs的当前部分。 $this->params['breadcrumbs'][] = 'About Us';在布局文件(也是一个视图)中 阅读全文
posted @ 2018-10-27 15:36 百事可口 阅读(461) 评论(0) 推荐(0)