使用PHP URL添加视频源

时间:2018-08-29 22:26:38

标签: php html html5

我正在使用PHP创建视频站点,并且想从PHP URL插入视频源代码。

例如,如果我想从PHP中获取第1集,则需要这样:

example.com/player.php?=episode1

第2集:

example.com/player.php?=episode2

我不明白如何将所有源页面与主索引页面链接起来。

我如何完成此任务?

1 个答案:

答案 0 :(得分:0)

您可以采用以下方法:在首页(index.html?)上使用表格来选择所需的视频,然后使用GET方法将其发送到player.php。然后在player.php上使用以下内容:

<?php
    $select = $_GET['select']; //This will be the number input for the video number
    echo("<video><source src="episode$select.mp4"></video>"); //This will source the video named `episodeX.mp4`, where `X` is the select value from the form on `index.html`.
 ?>

请问您是否需要任何其他说明。