- UID
- 112773
- 帖子
- 59
- 精华
- 0
- 贡献
- 0
- 推广
- 0
- 有效BUG
- 0
- 注册时间
- 2008-5-5
|
- function download($filename, $data)
- {
- $mimes = array( 'hqx' => 'application/mac-binhex40',
- *****,
- *****,
- );
- $x = explode('.', $filename);
- $extension = end($x);
- if ( ! isset($mimes[$extension]))
- {
- $mime = 'application/octet-stream';
- }
- else
- {
- $mime = (is_array($mimes[$extension])) ? $mimes[$extension][0] : $mimes[$extension];
- }
- if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE"))
- {
- header('Content-Type: "'.$mime.'"');
- header('Content-Disposition: attachment; filename="'.$filename.'"');
- header('Expires: 0');
- header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
- header("Content-Transfer-Encoding: binary");
- header('Pragma: public');
- header("Content-Length: ".strlen($data));
- }
- else
- {
- header('Content-Type: "'.$mime.'"');
- header('Content-Disposition: attachment; filename="'.$filename.'"');
- header("Content-Transfer-Encoding: binary");
- header('Expires: 0');
- header('Pragma: no-cache');
- header("Content-Length: ".strlen($data));
- }
- exit($data);
- }
复制代码
在IE下可以正常下载。换到TheWorld下载的则是我网站的后台管理入口文件。Opera、Chrome、TW2.X都行。就是3.X不行 |
|