PHP脚本在灯箱中打开视频文件

我在网站根目录之外的本地文件夹中有很多学生视频,我找到了如何通过 php 调用视频、隐藏文件源以及能够在网站根文件夹之外的解决方案。 现在我只想在灯箱中打开这个文件,但似乎无法做到。有人可以指出我正确的方向。 当前带有 html 索引和 php 播放文件的解决方案正在运行,看起来像这样 列表.html

<html lang="en">
<head>
<title>Test Video play list</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
</head>
<body>
<h1>Videos from DVD</h1>
<table>
  <tr>
    <th>Title</th><th>Description<th>
  </tr>
  <tr>
    <td><a href="vid.php?play_video=101">101 Intro Video</td> <td>Intro video description.....</td>
  </tr>
  <tr>
    <td><a href="vid.php?play_video=102">102 Foreword</td> <td>Foreword description.....</td>
  </tr>
</table>
</body>
</html>

然后我有一个 vid.php,如下所示:

<?php
if ( ($_SERVER['REQUEST_METHOD'] === "GET")
     && ( isset($_GET['play_video']) ) ) {
  if ($_GET['play_video'] == "101")  {
  $file_path_name = "../video/101-Intro.mp4";
  } elseif ($_GET['play_video'] == "102") {
  $file_path_name = "../video/102-Foreword.mp4";
  }
  $ctype= 'video/mp4';
  header('Content-Type: ' . $ctype);
  $handle = fopen($file_path_name,"rb");
  $contents = fread($handle,filesize($file_path_name));
  fclose($handle);
  echo $contents; 
} else {
echo "<h1>I'm Sorry wrong link</h1>";
}
?>

这样效果很好,可以直接在同一视频标签中播放视频,但我想在灯箱中播放。我试图将 php 文件插入到源代码中,但在我尝试的任何情况下都不起作用。
所以灯箱索引看起来像这样 List-Lightbox.html:

<!DOCTYPE HTML>
<html lang="en">
<head>
   <link rel="stylesheet" href="style/style.css?2020-2-7-0" media="screen,print" />
   <script src="res/jquery.js?2020-2-7-0"></script>
   <script src="res/x5engine.js?2020-2-7-0" data-files-version="2020-2-7-0"></script>

<title>Test Video play list</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
</head>
<body>
<h1>Videos from DVD</h1>
<table>
  <tr>
    <th>Title</th><th>Description<th>
  </tr>
  <tr>
    <td><a href="../video/Intro-101.mp4" onclick="return x5engine.imShowBox({ media:[{type: 'video',url: '../video/Intro.mp4',width: 1920,height: 1080,description: '101 Intro video'}]},this);" class="imCssLink">101 intro</a>
        </td> <td>Intro video description.....</td>
  </tr>
  <tr>
    <td><a href="vid.php?play_video=102" onclick="return x5engine.imShowBox({ media:[{type: 'video',url: 'vid.php?play_video=102',this);" class="imCssLink">102 Foreword</td> <td>Foreword description.....</td>
  </tr>
</table>
</body>
</html>

因此,如果我将 href 替换为 vid.php,它将直接播放如上所示的视频而无需灯箱。我也确实在 vid.php 中启动了灯箱,但也没有运气 感谢帮助 问候,

xuyihao 回答:PHP脚本在灯箱中打开视频文件

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/1049992.html

大家都在问