我试图使用php嵌入我保存在我网站上的视频。我使用以下代码,但我似乎无法让它工作。怎么做?:
HTML:
<video controls>
<source src="http://mysite2323.com/action/file/download?file_guid=884498" type=video/mp4>
</video>
PHP:
$mime = $file->getMimeType();
if (!$mime) {
$mime = "application/octet-stream";
}
$filename = $file->originalfilename;
// fix for IE https issue
header("Pragma: public");
header("Content-type: $mime");
header("Content-Disposition: inline; filename=\"$filename\"");
header("Content-Length: {$file->getSize()}");
while (ob_get_level()) {
ob_end_clean();
}
flush();
readfile($file->getFilenameOnFilestore());
exit;