有些时候我们在tp5的配置文件中写入了表前缀配置,那么我们在使用tp5构造查询的时候,如果去关联没有表前缀的表的时候查询就会报错,那么我们可以通过以下的方式去处理,保证数据的正常查询。
$pageres=Db::table("a_lawyer_problem_mepay")->alias("a")->join('lawyer.a_lawyer_user b', 'a.uid = b.id')->join('lawyer.a_lawyer_problem c', 'a.problemid = c.id')->join('lawyer.a_lawyer_problem_type d', 'c.problemtypeid = d.id')->field('a.uid as auid,a.price aprice,a.date adate,b.wechat_avatar bwechat_avatar,b.nickname bnickname,c.id cid,c.content ccontent,d.type dtype,c.information cinformation')->where($w)->order('a.time desc')->paginate($pnum);