First, share the header settings when the file is forced to download in CI.
[php "View plain Copy 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)); }
Others are better understood, mainly about the settings of Cache-control and pragma to make people more confused.
About Cache-control's must-revalidate: forcing pages to not cache, the same action as No-cache, but more stringent, mandatory means more obvious. For detailed functions, please refer to: http://hi.baidu.com/chenleibupt/blog/item/9627bec6932e5a179c163df2.html
About Post-check and pre-check:internet Explorer 5 use two new interval indications for HTTP header information: Pre-Check and Post-check. The Pre-Check extension defines a time interval, in seconds, after which an object should be selected for updating before it is displayed to the user. The selected object can also occur after the object has been displayed to the user, but ensure that the cached copy is updated the next time the user wants to see the object. The Post-check extension defines a time interval, in seconds, after which the object is selected for updating before it is displayed to the user. That is, Post-check=0,pre-check=0 is a IE5.0-only cache declaration. (Reference from http://bbs.chinaunix.net/thread-704320-1-1.html and http://blog.sina.com.cn/s/blog_5595d51401000b23.html)
About Pragma:no-cache, same as Cache-control:no-cache. Pragma:no-cache is compatible with HTTP 1.0, Cache-control:no-cache is provided with HTTP 1.1. Therefore, Pragma:no-cache can be applied to HTTP 1.0 and HTTP 1.1, while Cache-control:no-cache can only be applied to HTTP 1.1.
About the Pragma:public role is unknown, please also read this article of the heroes to give explanations.
HTTP Cache Correlation