Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php ob_gzhandler和CSS文件的问题_Php_Css_Internet Explorer_Firefox_Caching - Fatal编程技术网

Php ob_gzhandler和CSS文件的问题

Php ob_gzhandler和CSS文件的问题,php,css,internet-explorer,firefox,caching,Php,Css,Internet Explorer,Firefox,Caching,我已经创建了一个页面,将css或javascript文件作为一个文件输出。我注意到,当我使用ob_gzhandler压缩输出时,Firefox和Internet Explorer在任何时候都无法发送If Modified-Since头: 示例中更改了主机和引用人的初始标题: Response Headers Cache-Control public, must-revalidate, maxage=4838400 Connection keep-alive Content-Encoding

我已经创建了一个页面,将css或javascript文件作为一个文件输出。我注意到,当我使用ob_gzhandler压缩输出时,Firefox和Internet Explorer在任何时候都无法发送If Modified-Since头:

示例中更改了主机和引用人的初始标题:

Response Headers
Cache-Control   public, must-revalidate, maxage=4838400
Connection  keep-alive
Content-Encoding    gzip
Content-Length  87281
Content-Type    text/css; charset: UTF-8
Date    Wed, 12 Dec 2012 16:04:32 GMT
Expires Wed, 06 Feb 2013 16:04:32 GMT
Last-Modified   Fri, 12 Oct 2012 13:47:18 GMT
Pragma  public
Server  Apache
Vary    Accept-Encoding
X-Cache MISS from localhost
X-Powered-By    PHP/5.3.13

Request Headers
Accept  text/css,*/*;q=0.1
Accept-Encoding gzip, deflate
Accept-Language en-gb,en;q=0.5
Authorization   Basic cmVkZnVzZTpyM2RmdXMz
Cache-Control   no-cache
Connection  keep-alive
Cookie  PHPSESSID=e73355c49f06a059c22d7f02687dc51b
DNT 1
Host    example.com
Pragma  no-cache
Referer http://example.com/
User-Agent  Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0
Response Headers
Cache-Control   public, must-revalidate, maxage=4838400
Connection  keep-alive
Content-Encoding    gzip
Content-Length  87245
Content-Type    text/css; charset: UTF-8
Date    Wed, 12 Dec 2012 16:09:11 GMT
Expires Wed, 06 Feb 2013 16:09:11 GMT
Last-Modified   Fri, 12 Oct 2012 13:47:18 GMT
Pragma  public
Server  Apache
Vary    Accept-Encoding
X-Cache MISS from localhost
X-Powered-By    PHP/5.3.13

Request Headers
Accept  text/css,*/*;q=0.1
Accept-Encoding gzip, deflate
Accept-Language en-gb,en;q=0.5
Authorization   Basic cmVkZnVzZTpyM2RmdXMz
Cache-Control   max-age=0
Connection  keep-alive
Cookie  PHPSESSID=e73355c49f06a059c22d7f02687dc51b
DNT 1
Host    example.com
Referer example.com
User-Agent  Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0
在刷新主机上发送以下标题,并在示例中更改引用人:

Response Headers
Cache-Control   public, must-revalidate, maxage=4838400
Connection  keep-alive
Content-Encoding    gzip
Content-Length  87281
Content-Type    text/css; charset: UTF-8
Date    Wed, 12 Dec 2012 16:04:32 GMT
Expires Wed, 06 Feb 2013 16:04:32 GMT
Last-Modified   Fri, 12 Oct 2012 13:47:18 GMT
Pragma  public
Server  Apache
Vary    Accept-Encoding
X-Cache MISS from localhost
X-Powered-By    PHP/5.3.13

Request Headers
Accept  text/css,*/*;q=0.1
Accept-Encoding gzip, deflate
Accept-Language en-gb,en;q=0.5
Authorization   Basic cmVkZnVzZTpyM2RmdXMz
Cache-Control   no-cache
Connection  keep-alive
Cookie  PHPSESSID=e73355c49f06a059c22d7f02687dc51b
DNT 1
Host    example.com
Pragma  no-cache
Referer http://example.com/
User-Agent  Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0
Response Headers
Cache-Control   public, must-revalidate, maxage=4838400
Connection  keep-alive
Content-Encoding    gzip
Content-Length  87245
Content-Type    text/css; charset: UTF-8
Date    Wed, 12 Dec 2012 16:09:11 GMT
Expires Wed, 06 Feb 2013 16:09:11 GMT
Last-Modified   Fri, 12 Oct 2012 13:47:18 GMT
Pragma  public
Server  Apache
Vary    Accept-Encoding
X-Cache MISS from localhost
X-Powered-By    PHP/5.3.13

Request Headers
Accept  text/css,*/*;q=0.1
Accept-Encoding gzip, deflate
Accept-Language en-gb,en;q=0.5
Authorization   Basic cmVkZnVzZTpyM2RmdXMz
Cache-Control   max-age=0
Connection  keep-alive
Cookie  PHPSESSID=e73355c49f06a059c22d7f02687dc51b
DNT 1
Host    example.com
Referer example.com
User-Agent  Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0
如果我从使用ob_gzhandler切换到标准ob_start,那么它工作正常,并在第二次加载时返回预期的304


另一个我认为相关的问题是,当从android设备查看时,css既不适用于股票浏览器,也不适用于海豚浏览器,但适用于android的Firefox。这也可以通过禁用ob_gzhandler来解决。我们可以看到您正在使用的部分代码吗?不幸的是,我再也无法访问该代码了,但它基本上是一组文件读取,在刷新输出缓冲区之前在底部进行了回显。