tp5 query封装like查询语句

错误写法
$sql="select company_id from tplay_line where start like '%:start%' and end like '%:end%'";
$result =Db::query($sql,['start'=>$post['start'],'end'=>$post['end']]);

正确写法
$sql="select company_id from tplay_line where start like :start and end like :end";
$result =Db::query($sql,
[   'start'=>'%'.$post['start'].'%',
     'end'=>'%'.$post['end'].'%'     ]);
此条目发表在php分类目录。将固定链接加入收藏夹。

发表回复