脚本宝典收集整理的这篇文章主要介绍了php – 在Chrome中加载视频时的ERR_CONTENT_LENGTH_MISMATCH,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
Accept-Ranges:bytes Cache-Control:PRivate Connection:keep-alive Content-DisposITion:attachment; filename="About The Author.mp4" Content-Length:0 Content-Range:bytes 2990775-2990775/2990776 Content-transfer-encoding:binary Content-tyPE:video/mp4 Date:Tue,14 Feb 2017 13:46:24 GMT Last-Modified:Wed,08 Feb 2017 05:43:27 GMT Pragma:public Server:apache/2 VARy:User-Agent X-Powered-By:PHP/5.4.45
$filesize = filesize($resource->path); $matches = explode("-",substr($_SERVER['HTTP_RANGE'],6)); if (empty($matches[1])) { $matches[1] = $filesize - 1; } $offset = intval($matches[0]); $length = intval($matches[1]) - $offset; $file = fopen($resource->path,'r'); fseek($file,$offset); $data = fread($file,$length); fclose($file); header('HTTP/1.1 206 Partial Content'); header('Content-Range: bytes ' . $offset . '-' . ($offset + $length) . '/' . $filesize); header('Pragma: public'); header('Last-Modified: '.gmdate ('D,d M Y H:i:s',filemtime ($resource->path)).' GMT'); header('Cache-Control: private',false); header('Content-Type: ' . $mime); header('Content-Length: ' . ($length + 1)); header('Content-Disposition: attachment; filename="' . $resource->filename . '"'); header('Content-transfer-encoding: binary'); header('Accept-Ranges: bytes'); print($data);
对不起,我的英语不好.
以上是脚本宝典为你收集整理的php – 在Chrome中加载视频时的ERR_CONTENT_LENGTH_MISMATCH全部内容,希望文章能够帮你解决php – 在Chrome中加载视频时的ERR_CONTENT_LENGTH_MISMATCH所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。