[英]PHP headers to stream a wmv video file
当我直接指向文件时,它会在浏览器中播放,但是如果我尝试通过PHP播放它,它将无法正常工作。 我的代码是:
<?php
$file = 'videos/video.wmv';
$file_name = 'video.wmv';
$file_type = 'video/x-ms-wmv';
header('Content-Description: File Transfer');
header('Content-Disposition: filename="'.$file_name.'"');
header('Content-Type: '.$file_type);
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($file));
header('Cache-Control: post-check=0, pre-check=0');
header('Pragma: public');
header("Accept-Ranges: bytes");
header('Expires: 0');
readfile($file);
?>
它可以与PDF,rar和zip文件配合使用,但不能用于流视频。 WMP窗口出现,但视频不播放。
谢谢你的帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.