toArray 一直错误

浏览:4215 发布日期:2017/05/26 分类:求助交流 关键字: bug 错误 疑问 tp5
代码如下
public function ajax()
{
$rs = DlModel::with('editor')->select();
return ['data'=>collection($rs)->toArray()];
}
错误信息如下:InvalidArgumentException in Response.php line 316
variable type error: array
    {
        if (null == $this->content) {
            $content = $this->output($this->data);

            if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable([
                    $content,
                    '__toString',
                ])
            ) {
                throw new \InvalidArgumentException(sprintf('variable type error: %s', gettype($content)));
            }

            $this->content = (string) $content;
        }
        return $this->content;
    }
备注:Editor信息能获取

另外发现with后不能使用all
最佳答案
评论( 相关
后面还有条评论,点击查看>>