【发布时间】:2016-12-19 01:54:13
【问题描述】:
我正在尝试显示存储在“存储”文件夹中的图像,以保护图像文件夹。我应该如何处理 2 个参数,下面的代码效果不佳:
路线:
Route::get('img/users/{id}/logo/{image}', function($id = null, $image = null)
{
$path = storage_path().'/img/profils/'.$id.'/logo/'.$image;
if (file_exists($path)) {
return Response::download($path);
}
});
查看:
src="{!!asset('img/users/'.$user->id.'/logo/'.$user->imagelogo)!!}"
【问题讨论】:
-
发布错误
-
怎么,没看懂?
-
我无法通过配置文件获取图像,但如果我这样做,请设置用户的 id,它会显示图像配置文件:Route::get('img/users/2/logo/ {image}', function($id = null, $image = null) { $path = storage_path().'/img/profils/2/logo/'.$image;