[top-think/think]tp6 BelongsToMany关联模型加field报错:strpos() expects parameter 1 to be string, object given

2023-12-11 647 views
9

ThinkPHP版本:6.0.0
think-orm:2.0 image

回答

3

加上这一串代码,问题解决了

if ($field instanceof \think\db\Raw) {
    $field = $field->getValue();
}

image

7

应该判断是Db::raw就跳过吧,用了raw就是不希望系统再适配的