iep*_*iep 3 laravel-5 php-7 lumen
我需要将流明资源服务器中的文件内容(例如图像和其他mime类型)流式传输到Laravel客户端服务器。我知道在Laravel中我可以使用:
$headers = ['Content-Type' => 'image/png'];
$path = storage_path('/mnt/somestorage/example.png')
return response()->file($path, $headers);
Run Code Online (Sandbox Code Playgroud)
但是,file中没有该方法Laravel\Lumen\Http\ResponseFactory。
任何建议都非常欢迎。
在流明中,您可以使用Symfony的BinaryFileResponse。
use Symfony\Component\HttpFoundation\BinaryFileResponse
$type = 'image/png';
$headers = ['Content-Type' => $type];
$path = '/path/to/you/your/file.png';
$response = new BinaryFileResponse($path, 200 , $headers);
return $response;
Run Code Online (Sandbox Code Playgroud)
您可以在此处找到文档。
| 归档时间: |
|
| 查看次数: |
2642 次 |
| 最近记录: |