欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程语言 > php >内容正文

php

用PHP实现手机对jar,jad文件的下载(转)

发布时间:2024/8/1 php 46 豆豆
生活随笔 收集整理的这篇文章主要介绍了 用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文件的下载(转)的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。