第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在流明中顯示來自/storage/app/public 的圖像?

如何在流明中顯示來自/storage/app/public 的圖像?

PHP
富國滬深 2023-07-21 15:52:20
我從 API 得到了 JSON 格式的響應(yīng),其中包含內(nèi)容文件名、創(chuàng)建時間、user_id 和 URL。所以我想通過將 URL 放入 來顯示前端響應(yīng)中的圖像<img src={props.generated} alt="image"/>。我的前端代碼沒有任何問題,但沒有顯示圖像。這是我的響應(yīng)中的圖像 URLhttp://localhost:8000/storage/public/user_3/1594265090.jpeg當(dāng)我訪問 URL 時,這里是瀏覽器中的響應(yīng)The requested resource /storage/public/user_3/1594265090.jpeg was not found on this server.這是我的代碼      $response = $this->client->request('POST', 'API', $data);        $image = $response->getBody()->getContents();        $filePath = 'public/' . $this->getUserDir();        $fileName = time().'.jpeg';                 if ($result = Storage::put($filePath . '/' . $fileName, $image)) {                $generated =  $model::create([                    'name' => $fileName,                    'file_path' => $filePath,                    'type' => 'motif',                    'customer_id' => Auth::id()                ]);                return response($generated);放入圖像/storage/app/public,我確信它會發(fā)生,因為目錄的位置。我已經(jīng)在嘗試執(zhí)行命令mklink /D "./storage/app/public" "./public/storage"并收到響應(yīng)Cannot create a file when that file already exists.
查看完整描述

1 回答

?
HUWWW

TA貢獻(xiàn)1874條經(jīng)驗 獲得超12個贊

我正在使用ln -rs ./storage/app/public ./public/storage. 但這個命令是Linux的,所以我git bash在我的項目目錄中使用并執(zhí)行這個命令。

結(jié)果解決了,可以訪問圖片了。


查看完整回答
反對 回復(fù) 2023-07-21
  • 1 回答
  • 0 關(guān)注
  • 126 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號