PHP header Jump IE problem _php tutorial

Source: Internet
Author: User
Movie Station offers the movie BT download, due to the use of the Polaroid player, upload a movie when uploading a movie hash file. Using this hash file, the first time the request is dynamically generated, the corresponding BT seed is saved (specified path) and provided for download. When the user clicks to download the BT seed, first to the corresponding directory to detect the corresponding BT seed file exists, if present, then directly provide the download, or Mr. Cheng, and then download.

Download the BT seed directly in the file using the header jump method. The PHP file itself is GBK encoded.

Later found that in Chrome and Firefox and IE6 in the normal work, but in the IE8 will appear to find the case of no files. This makes me very depressed, IE6 can do, the result IE8 still have problem.

[PHP]
Point to Torrent file, provide download
$torrent _file_url = "torrent/tyvod1/sci-fi film/Raytheon torrent"
$redirect _url = "http://vod.cqjtu.edu.cn/". $torrent _file_url;
Header ("http/1.1 303 See other");
Header ("Location:". $redirect _url);
Exit ();
After the comparison test, it is found that if there is Chinese in the path, IE8 will not be able to download. The PHP file itself is GBK encoded, so we first convert the GBK encoded string to UTF8 encoding before jumping.

[PHP]
Point to Torrent file, provide download
$torrent _file_url = "torrent/tyvod1/sci-fi film/Raytheon 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 ();
This is no problem with Chrome and Firefox and IE8 and IE9, but it's not possible to download them in IE6. Chinese garbled. Check the information after said because IE6 to UTF-8 support is not perfect. GBK IE is really difficult to serve, whether it is a code or UTF-8 code, chrome and Firefox can correctly parse, ie home Brother actually out of such a problem.

Did not find a good way, had to specifically for the IE6 do a bit ...
[PHP]
Point to Torrent file, provide download
$torrent _file_url = "torrent/tyvod1/sci-fi film/Raytheon 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) {//non-IE6
Header ("Location:". Iconv ("GBK", "Utf-8", $redirect _url));
}else{//ie6
Header ("Location:". $redirect _url);
}
Exit ();
Author: jdluojing

http://www.bkjia.com/PHPjc/478141.html www.bkjia.com true http://www.bkjia.com/PHPjc/478141.html techarticle Movie Station offers the movie BT download, due to the use of the Polaroid player, upload a movie when uploading a movie hash file. Using this hash file, the first time you request a dynamic ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.