thinkphp5查詢表達式IN使用小計


根據多個id批量更新指定字段值

$map[] = ['id','in', input('post.id/a')]; 

$result = db('picture')->where($map)->update(['posid' => 1]);

相當於sql語句: 

UPDATE `yj_picture`  SET `posid` = 1  WHERE  `id` IN (1,2,3)

 

使用表達式like進行模糊查詢

$map[] = array('title','like','%'.$keywords.'%');

db('picture')->where($map)->find();

持續更新.......懶得整理......


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM