think\db\Builder::parseExp() must be an instance

浏览:932 发布日期:2019/11/19 分类:ThinkPHP5专区
通过命令行添加自定义命令运行的查询数据库报错,版本v5.1.35 LTS
报错如下: [think\exception\ErrorException]                                                                                                                                                                                
  Argument 4 passed to think\db\Builder::parseExp() must be an instance of think\db\Expression, string given, called in /data/wwwroot/default/dbwd/thinkphp/library/think/db/Builder.php on line 424 and defined
文件/thinkphp/library/think/db/Builder.php
第424行的代码$whereStr = $this->$fun($query, $key, $exp, $value, $field, $bindType, isset($val[2]) ? $val[2] : 'AND');这里的$fun第四个参数$value为啥传递字符串而下面这里却要求expression,怎么回事,
第499到503行的代码    protected function parseExp(Query $query, $key, $exp, Expression $value, $field, $bindType)
    {
        // 表达式查询
        return '( ' . $key . ' ' . $value->getValue() . ' )';
    }
最佳答案
评论( 相关
后面还有条评论,点击查看>>