ThinkPHP3.2.3 表达式查询问题

浏览:1000 发布日期:2018/07/14 分类:求助交流
今天在查询MySQL数据库的时候遇到一个奇怪的地方:
查询关键字为“UNION”时,返回了意外的结果。

Controller代码如下:
$where['post_type'] = array('like', '%UNION%');
$where['post_from'] = array('like', '%UNION%');
$where['_logic'] = 'or';
$count = $Blog->where($where)->count();

但是在Trace中看到生成的SQL语句如下:
SELECT COUNT(*) AS tp_count FROM `wu_blog` WHERE `post_type` LIKE '' OR `post_from` LIKE '' LIMIT 1 [ RunTime:0.0005s ]

查询的关键字在生成的SQL语句中消失了??
最佳答案
评论( 相关
后面还有条评论,点击查看>>