[英]How to retrieve(in controller) and display video in a Laravel Blade
我已成功從數據庫中檢索到帶有擴展名的視頻名稱,但它沒有顯示在刀片服務器上。 這是我檢索和轉儲時的結果
$video_data = DB::select('select * from videos')[4]->file?? null;
dd($video_data);
“big_buck_bunny_720p_2mb.mp4”
Display in Laravel
<video width="320" height="240" controls>
<source class="embed-responsive-item" src="{{URL('/storage/Atayads/Video/'.$video_data)}}" allowfullscreen>
</video>
請注意,我只顯示了一個符合上面數組的視頻。
現在我遇到的問題是它不顯示視頻,也沒有錯誤
請幫助
您是否嘗試過根據 laravel 文檔創建符號鏈接
php artisan storage:link
這將創建一個從 public/storage 到 storage/app/public 的符號鏈接,您可以從 /storage/app/public 訪問該文件
http://example.com/storage/big_buck_bunny_720p_2mb.mp4
對於完整路徑,您可以使用類似下面的內容
$path = storage_path('public/' . $video_data);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.