Yii框架条件查询+join查询一起的使用
$data = (new \yii\db\Query()) ->select(['user.id','user.username','user.imgs','pet.id as pet_id','pet.pet_name','pet.pet_birth_time','pet.pet_sex','pet.wechat','pet.message','pet.pet_imgs','pet.phone','pet_category.cate_name','pet.address','city.city_name','user.sex','user.birth_time']) ->from('pet') ->where(['like','ewm_url',$ewm]) ->leftJoin('user','pet.user_id = user.id') ->leftJoin('city','user.city_id = city.city_id') ->leftJoin('pet_category','pet.pet_category=pet_category.id') ->one();
通往牛逼的路上,在意的只有远方!