如何在php中控制视频
我有一个录像带 我创建文件PHP来查看视频(view.PHP) 在这个文件中,我在数据库上创建了两次令牌保存 我使用embed在get.php文件中获取文件的数据 例如:如何在php中控制视频,php,video,Php,Video,我有一个录像带 我创建文件PHP来查看视频(view.PHP) 在这个文件中,我在数据库上创建了两次令牌保存 我使用embed在get.php文件中获取文件的数据 例如: <embed src="get.php?v=filename&t=token"></embed> 在get.php文件中,我使用file_get_content()函数获取数据视频文件并对其进行回显,并使用了use header(“content type:video/mp4”) 在vie
<embed src="get.php?v=filename&t=token"></embed>
在get.php文件中,我使用file_get_content()函数获取数据视频文件并对其进行回显,并使用了use header(“content type:video/mp4”)
在view.php文件中,视频播放成功,但我无法控制它
如何解决这个问题
Code view.php
<?php
if (count($_GET) == 1 && count($_POST == 0) && isset($_GET['v'])){
$token = substr(md5($_GET['v']), 0, 20);
$time = time();
$token = $time . $token;
require_once ('./global.php');
require_once ('./include/database.php');
$db = new Database();
if ($db->insert( 'token', array( 'tokencode' => $token ) )){
if ($db->insert( 'token', array( 'tokencode' => $token ) )){
?>
<embed src="./get.php?v=<?php echo $_GET['v'] ?>&t=<?php echo $token; ?>" width="900" height="550" type="video/mp4"></embed>
<?php
} }
}
<?php
if (count($_GET) == 2 && count($_POST) == 0 && isset($_GET['v']) && isset($_GET['t'])){
require_once ('./global.php');
require_once ('./include/database.php');
$db = new Database();
$numT = $db->count('token', 'tokenid', array(array( 'tokencode', $_GET['t'] )));
if ($numT > 0){
$listT = $db->selectMultiple('token', array(array( 'tokencode', $_GET['t'] )));
if (count($listT) > 1){
$where = array(array( 'tokencode', $_GET['t'], '&&' ), array( 'tokenid', $listT[0]['tokenid'] ));
}else{
$where = array(array( 'tokencode', $_GET['t'] ));
}
if ($db->delete('token', $where)){
$f = file_get_contents('ch01-01.mp4');
unset($db);
header("Content-Type: video/mp4");
echo $f;
}
}
}