如何在laravel视图中显示视频

时间:2017-05-10 04:24:52

标签: php video laravel-5.4

我正在使用laravel 5.4我需要在我的产品详情页面中显示一个视频,但视频显示不正确..

这是我的观点

@foreach($detail_videos as $video)
               <video width="100" height="100" controls class="thumb" data-full="{{ asset($video) }}">
                 <source src="{{ asset($video) }}">
               </video>
               @endforeach

在我的控制器中,我这样给出

  $detail_dir_videos = 'uploads/products/videos/'.$getProduct->id;
      $detail_dir_videos_files = array_slice(scandir($detail_dir_videos), 2);
      $detail_videos = [];
      foreach($detail_dir_videos_files as $detail_dir_videos_file){
        $detail_videos[] = $detail_dir_videos.'/'.$detail_dir_videos_file;
      }
 return view('pages.product_detail', ['videos'=>$videos,'detail_videos'=>$detail_videos ])

现在视频没有显示在我的视图中可以请任何人帮我解决这个问题。

1 个答案:

答案 0 :(得分:1)

编辑此代码并检查

$detail_videos = [];
      foreach($detail_dir_videos_files as $detail_dir_videos_file){
        $detail_videos= $detail_dir_videos.'/'.$detail_dir_videos_file;
      }