电影站提供电影bt下载,由于使用宝丽通播放器,上传电影的时候会同时上传一个电影的hash文件。利用这个hash文件,第一次请求时动态的生成对应的bt种子保存(指定路径)并提供下载。当用户点击下载bt种子的时候,首先到对应的目录下检测对应的bt种子文件是否存在,如果存在,则直接提供下载,否则先生成,再下载。
Bt种子的下载直接在文件中使用header跳转的方式。php文件本身是gbk编码。
后来发现,在chrome和firefox和ie6中都能正常工作,但是到了ie8中会出现找打不文件的情况。这让我很郁闷,ie6都能行,结果ie8还有问题。
[php]
//指向torrent文件,提供下载
//$torrent_file_url = "torrent/tyvod1/科幻片/雷神托尔.torrent"
$redirect_url = "http://vod.cqjtu.edu.cn/".$torrent_file_url;
Header("HTTP/1.1 303 See Other");
Header("Location: ".$redirect_url);
exit ();
经过对比测试,发现如果路径中有中文,ie8就没法下载。php文件本身是GBK编码,于是我们在跳转之前,先将gbk编码的字符串转换为utf8编码。
[php]
//指向torrent文件,提供下载
//$torrent_file_url = "torrent/tyvod1/科幻片/雷神托尔.torrent"
$redirect_url = "http://vod.cqjtu.edu.cn/".$torrent_file_url;
Header("HTTP/1.1 303 See Other");
Header("Location: ".iconv("gbk","utf-8",$redirect_url));
exit ();
这下,在chrome和firefox以及ie8和ie9中都没问题了,但是在ie6中又不能下载了。中文乱码。查资料之后说是因为ie6对UTF-8的支持不够完善。尼玛ie还真难伺候,无论是GBK编码还是UTF-8编码,chrome和firefox都能正确解析,ie自家兄弟居然出这样的问题。
没找到好的办法,只得专门为ie6做一下…
[php]
//指向torrent文件,提供下载
//$torrent_file_url = "torrent/tyvod1/科幻片/雷神托尔.torrent"
$redirect_url = "http://vod.cqjtu.edu.cn/".$torrent_file_url;
Header("HTTP/1.1 303 See Other");
if(strpos($_SERVER['HTTP_USER_AGENT'],'MSIE 6.0')===false){//非ie6
Header("Location: ".iconv("gbk","utf-8",$redirect_url));
}else{//ie6
Header("Location: ".$redirect_url);
}
exit ();
作者:jdluojing

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Zend Studio 13.0.1
Powerful PHP integrated development environment
