升级 TP5.1 拼接where不生效

浏览:967 发布日期:2018/04/08 分类:求助交流 关键字: TP5.1 where
public function getAllInfo($table,$condition=[],$field='*'){
        try{
            $table->field($field);
            if(!empty($condition)){
                if(required_attr($condition,'where'))
                    $table->where($condition['where']);
                if(required_attr($condition,'order'))
                    $table->order($condition['order']);
                if(required_attr($condition,'limit'))
                    $table->limit($condition['limit']);
            }
            $result=$table->select()->toArray();
        }catch(\Exception $e){
            return $e;
        }catch(\Error $e){
            return $e;
        }


        return $result;
}
where 条件不生效
直接写成链式操作可以生效$table->where($condition['where'])->select()->toArray()

[email][/email]
最佳答案
评论( 相关
后面还有条评论,点击查看>>