此laravel route有時會返回圖像,並且在其他時間返回錯誤頁面。什麼可能會出錯。這個Laravel路線每次都會返回不同的答案 - 我在哪裏尋找錯誤?
這條路線只返回類似這樣的形象:
public function image(Request $request) {
return response()->file(storage_path('app/'.$request->input('path')));
}
我存儲使用此代碼的圖像:
$path = $request->p->store('public/images');
Storage::setVisibility($path, 'public');
我不知道發生了什麼錯誤。當請求路由時,我會看到這個日誌。
NOTICE: PHP message: [2017-09-25 18:33:25] production.ERROR: Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException: The file "/app/storage/app/public/images/YxNllK0iVKAxxUSCEhFHLo5sGZiXg5NNbGDbOVSL.jpeg" does not exist in /app/vendor/symfony/http-foundation/File/File.php:37
,路線在它的盛開:
https://resonant-tower-177816.appspot.com/showimage?path=public/images/YxNllK0iVKAxxUSCEhFHLo5sGZiXg5NNbGDbOVSL.jpeg
這絕對不是因爲沒有圖像出現。我可以向你保證這條路線在某些時候有效。
出了什麼問題?
我在Google App Engine上使用Laravel 5.4。
我很抱歉。這是一個愚蠢的問題。我在兩個實例上運行Laravel。顯然,Google雲應用引擎Flex環境自動擴展爲2個實例 –