用PHP实现手机对jar,jad文件的下载(转)
如果我们需要在站点提供jar和jad的手机下载,就必须在服务器设置两个MIME
jad:
text/vnd.sun.j2me.app-descriptor
jar:
application/java-archive
而对于一般的虚拟主机来说,我们客户是无法设置的。。
所以,我们必须借助PHP里的header来实现。。
文件:
------------------------
test.jad
test.jad.php
test.jar
test.jar.php
------------------------
修改文件--------
test.jad:
我们先打开,找到这么一行。。
MIDlet-Jar-URL: test.jar
该行的作用是引导手机下载。。
我们现在把它改为test.jar.php
test.jad.php:
<?php
$file_url="test.jad";
$handle=fopen($file_url,"r");
header("Content-Type:text/vnd.sun.j2me.app-descriptor");
echo fread($handle,filesize($file_url));
fclose($handle);
?>
test.jar.php:
<?php
$file_url="test.jar";
$handle=fopen($file_url,"r");
header("Content-Type:application/java-archive");
echo fread($handle,filesize($file_url));
fclose($handle);
?>
---------------------------------------
本页地址http://www.yubeinet.com/article.php/id/21/index.html?
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10294527/viewspace-125340/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10294527/viewspace-125340/
总结
以上是生活随笔为你收集整理的用PHP实现手机对jar,jad文件的下载(转)的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 经典游戏IP:传统端游大厂的成功“捷径”
- 下一篇: php实现身份证号码获取归属地地址的实例