对于我的laravel api,我在json中返回一个包含 Headers 和图像链接的对象 .
但在laravel我不知道在哪个文件夹以及如何返回将在移动应用程序上显示的图像的完整链接 .
数据保存在mysql数据库中
例:
{
"title" : "example",
"image" : "http://www.example.com/images/example.png"
}
谢谢你的帮助
-------------更新------------
我添加一个测试路线:
Route::get('v1/pictures/{filename}',function($filename){
return asset('/storage/app/public/images/'.$filename);
});
当我打电话:http://localhost:8000/api/v1/pictures/chat1.jpg我得到:http://localhost:8000/storage/app/public/images/chat1.jpg
但是当我转到此链接时,我发现了一个错误:对不起,找不到您要查找的页面 .
1 回答
这应该回应像