我有一个wapsite,我正在实施强有力的下载。
脚本是PHP
它适用于所有其他移动浏览器,但是当我使用ANDROID手机访问该网站时,它会下载实际的php文件。
以下是我的文件downloadFiles.php。
的代码片段$ fileExt =“jpg”; $ strOrgFileName =“abc.jpg”;
开关($ fileExt) {
案例“jpeg”:
case“jpg”:$ ctype =“image / jpg”;打破;
case“gif”:$ ctype =“image / gif”;打破;
case“png”:$ ctype =“image / png”;打破;
case“zip”:$ ctype =“application / zip”;打破;
默认:$ ctype =“application / force-download”;
}
标题(“Pragma:public”);
标题(“过期:0”);
header(“Cache-Control:must-revalidate,post-check = 0,pre-check = 0”);
标题(“Content-Type:$ ctype”);
标题(“内容描述:文件传输”);
header(“Content-Disposition:attachment; filename = \”“。$ strOrgFileName。”\“;”);
的ReadFile($ strOrgFileName);
在Android系统中,它会下载php文件。
即。 downloadFiles.php
请通过此帮助。
答案 0 :(得分:0)
任何应该能够下载.php源文件的唯一方法是,如果您的Web服务器存在某种错误配置。如果其他php正在通过android工作,也许在android和这个文件中的东西导致整个服务器绊倒和barf ...但这应该打倒整个服务器,而不是简单地转储文件。
我也错过了什么吗?这真是个难题......
答案 1 :(得分:0)
要使所有(特别是旧版本)Android版本按预期进行任何下载,您需要...
阅读我的博客文章了解更多详情:
http://digiblog.de/2011/04/19/android-and-the-download-file-headers/
干杯,Jpsy。