用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:传统端游大厂的成功“捷径”
- 下一篇: python爬取豆瓣电影名称与评分进行分