码迷,mamicode.com
首页 > 其他好文 > 详细

CodeIgniter框架下载辅助函数的一个小bug

时间:2014-10-09 15:00:33      阅读:160      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   io   os   ar   sp   div   

        if (strpos($_SERVER[‘HTTP_USER_AGENT‘], "MSIE") !== FALSE)
        {
            header(‘Content-Type: ‘.$mime); // <---1)这里
            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); // <---2)这里
            header(‘Content-Disposition: attachment; filename="‘.$filename.‘"‘);
            header("Content-Transfer-Encoding: binary");
            header(‘Expires: 0‘);
            header(‘Pragma: no-cache‘);
            header("Content-Length: ".strlen($data));
        }

修改前代码:

        if (strpos($_SERVER[‘HTTP_USER_AGENT‘], "MSIE") !== FALSE)
        {
            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));
        }

 

CodeIgniter框架下载辅助函数的一个小bug

标签:style   blog   http   color   io   os   ar   sp   div   

原文地址:http://www.cnblogs.com/shaoyikai/p/4012907.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!