PHP导出到Excel,在iPad上

PHP导出到Excel,在iPad上,php,ios5,Php,Ios5,我有一个脚本将mysql结果输出到excel,在所有浏览器中都可以正常工作。 不过,我还需要这个脚本在iPad上工作,在Safari中打开excel。此时,脚本只是“挂起”在iPad上,它一直在加载。这是个问题吗? 此时的代码标题为: header( 'Content-Transfer-Encoding: binary' ); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header('Content-

我有一个脚本将mysql结果输出到excel,在所有浏览器中都可以正常工作。 不过,我还需要这个脚本在iPad上工作,在Safari中打开excel。此时,脚本只是“挂起”在iPad上,它一直在加载。这是个问题吗? 此时的代码标题为:

header( 'Content-Transfer-Encoding: binary' );
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-Type: application/vnd.ms-excel');
//header("Content-Type: application/octet-stream");
header('Content-Disposition: attachment;filename="' . $_POST['Client_FirstName'] . ' ' .     $_POST['Client_LastName'] . ' ' . $_POST['month'] . '-' . $_POST['year'] . '.xlsx"');
header('Cache-Control: max-age=0');
header("Pragma: public");
header("Expires: 0");

显然是应用程序/vnd.ms-excel头导致了问题。 将其设置为八进制流解决了这个问题,但随后在IE8中引发了问题。 所以我用这段代码完全解决了这个问题:

if(stristr($_SERVER['HTTP_USER_AGENT'], 'ipad') OR stristr($_SERVER['HTTP_USER_AGENT'],     'iphone') OR stristr($_SERVER['HTTP_USER_AGENT'], 'ipod')) 
{ 
  header("Content-Type: application/octet-stream"); 
}else{ 
  header('Content-Type: application/vnd.ms-excel'); 
}

据我所知,IOS上的Safari无法处理文件下载。在一个新窗口中打开它?也不是,现在我认为没有一个不使用本机应用程序的解决方案。也许这可以帮助你感谢Michi,但只有在iPhone上安装应用程序,这才有效,对吗?我想要的是,在我的iPad上,我在Safari中打开Dropbox,我在Safari中获得界面,当我单击excel文件时,它在Safari中的一个新选项卡中打开,也让我可以选择“使用”其他应用程序(Dropbox,…)