首页 > 解决方案 > 升级到 5.7 后 Laravel 调用未定义的方法 getOriginalContent

问题描述

所以,我将我的 Laravel 项目从 5.6 升级到了 5.7.13。我在控制器的功能中将此代码作为文件传递方法(以前可以正常工作):

public function sendFile(Request $request)
{
    $request->validate([
        'path' => 'required|string|min:1|max:256',
    ]);

    return Storage::download($request->path);
}

但现在我得到:

Call to undefined method Symfony\Component\HttpFoundation\StreamedResponse::getOriginalContent()

我已经检查了文件的存在。事实上,这很好用:

    if(Storage::exists($request->path)) return 'true';

我没有编辑任何供应商文件。那么,这里有什么问题呢?

标签: laravel

解决方案


你安装了 laravel/telescope 吗?此问题已正式修复。你需要更新 laravel/telescope。 https://github.com/laravel/telescope/commit/e4f5c0dd07970fb73fbf79cfa96316b7f91560cf


推荐阅读