我正在使用 Laravel 5.8 版本开发 API 应用程序。当向productsapi 端点发出 get 请求时,我返回一个如下所示的ProductResource集合public function toArray($request){ return [ 'id' => $this->id, 'name' => $this->name, 'category' => $this->category, 'description' => $this->description, 'status' => $this->status, 'price' => $this->price, 'barrels' => $this->barrels, 'interest' => $this->interest, 'start' => $this->start, 'end' => $this->end, 'hidden' => $this->hidden, 'imageUrl' => asset('storage/images/products/' . $this->image->name) ];}我面临的挑战是,在我的本地服务器上单击返回imageUrl的图像显示正确的图像,但在登台环境中,我得到了默认的404未找到页面。我在我正在开发的本地服务器上创建了一个符号链接,public/storage用于storage/app/public在将应用程序文件上传到登台环境之前存储实际的图像文件。快速检查storage/app/public/images/products临时环境中的 会显示图像文件,但我仍然无法从浏览器中查看它。这种行为的可能原因是什么?这是我的本地和登台环境中的资源示例本地/开发服务器{ "id": 17, "name": "test", "category": "test", "description": "test", "status": "test", "price": 10990, "barrels": 207736, "interest": 0.2, "start": "2019-07-25", "end": "2019-08-25", "hidden": 0, "imageUrl": "http://localhost:8000/storage/images/products/pramopro_test_17.jpeg" }登台服务器{ "id": 13, "name": "test prod", "category": "test prod category", "description": "test prod description", "status": "loading", "price": 10000, "barrels": 300000, "interest": 0.2, "start": "2019-07-22", "end": "2019-08-28", "hidden": 0, "imageUrl": "http://staging.pramopro.com/storage/images/products/pramopro_testprod_13.jpeg" }
目前暂无任何回答
- 0 回答
- 0 关注
- 103 浏览
添加回答
举报
0/150
提交
取消