thinkphp6 踩坑数组查询不识别

    public static function handel($address,$searach,$select){
       $arr = explode(',',$address['id']); 
    //    $data['province_id'] =$arr[0];
    //    $data['city_id']     =$arr[1]; 
    //    $data['town_id']     =$arr[2];

       $map = [
            ['province_id','=',$arr[0]],
            ['city_id','=',$arr[1]],
            ['town_id','=',$arr[2]],
        ];
        if($searach)$map[]= ['address','like','%'.$searach.'%'];

        $info = Db::table('store')->where($map)->fetchSql(true)->select();  
        dump($info);exit;
        return $info;
    }

thinkphp6不能用

    //    $data['province_id'] =$arr[0];
    //    $data['city_id']     =$arr[1]; 
    //    $data['town_id']     =$arr[2];

           $data['town_id']     =array('like','%'.$searach.'%')

这样的形式默认在前面加了in

;

    

 

你可能感兴趣的:(thinkphp)