我有一个基于Web的系统,基于会话变量建立用户登录数据。当我用php/html导出文件我的会话数据重置
有时,当用户登录并尝试将表导出到csv或xls时,会话数据似乎被擦除,用户被“踢出”系统。
这是我用来提供文件的标题代码。
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment;filename=file.xls");
header("Content-Transfer-Encoding: binary ");
如果它有帮助,它似乎在ie6上更普遍。我想知道是否有人有类似的问题。
这是我试过的最新的头文件。仍然没有运气。还测试了完全相同的程序在FF /歌剧/ Safari和他们很好。
header('Cache-Control: no-store, private, no-cache, must-revalidate'); // HTTP/1.1
header('Cache-Control: pre-check=0, post-check=0, max-age=0, max-stale = 0', false); // HTTP/1.1
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Expires: 0', false);
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Pragma: no-cache');
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: attachment;filename=$fileName");
header("Content-Transfer-Encoding: binary ");
expires标题应该采用这种格式(yes GMT):过期:1994年12月1日星期四16:00:00 GMT – OIS 2009-09-03 15:34:31