美文网首页
TP5 接口报错 Call to a member functi

TP5 接口报错 Call to a member functi

作者: 一生悬命Cat | 来源:发表于2019-10-13 23:29 被阅读0次

products = Product::all(oPIDs)->visible(['id','price','stock','name','main_img_url'])
->toArray(); 报错

解决

在模型类 model/Product.php中加入一行代码,应该就可以了。

protected $resultSetType = 'collection'; //设置返回数据集的对象名

相关文章

网友评论

      本文标题:TP5 接口报错 Call to a member functi

      本文链接:https://www.haomeiwen.com/subject/ptqlmctx.html