Php header jump to ie

Source: Internet
Author: User

The movie site provides bt download for the movie. Because the Polaroid player is used, a hash file of the movie will be uploaded at the same time when uploading the movie. This hash file is used to dynamically generate the corresponding bt seed for saving (specifying the path) during the first request and provide download. When you click to download the bt seed, first check whether the corresponding bt seed file exists in the corresponding directory. If yes, download it directly. Otherwise, download it again.

The download of Bt seeds directly uses the header redirection method in the file. The PHP file is gbk encoded.

Later, we found that chrome, firefox, and ie6 both work normally, but in ie8, we may find that files cannot be found. This made me very depressed. ie6 can be used, and the result is still problematic in ie8.

[Php]
// Point to the torrent file for download
// $ Torrent_file_url = "torrent/tyvod1/science fiction/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 comparison and test, it is found that ie8 cannot be downloaded if the path contains Chinese characters. The PHP file itself is GBK encoded, so before the jump, we first convert the gbk encoded string to utf8 encoding.

[Php]
// Point to the torrent file for download
// $ Torrent_file_url = "torrent/tyvod1/science fiction/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 ();
Now, there is no problem in chrome, firefox, ie8, and ie9, but it cannot be downloaded in ie6. Chinese characters are garbled. The reason is that ie6's support for UTF-8 is not perfect. Nima ie is really difficult to serve, whether it is GBK encoding or UTF-8 encoding, chrome and firefox can be correctly resolved, ie's own brother has such a problem.

I didn't find a good solution. I had to do it for ie6...
[Php]
// Point to the torrent file for download
// $ Torrent_file_url = "torrent/tyvod1/science fiction/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

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.