我写的代码如下:
<?php
function query(){
$file_name = "info_check.exe";
$file_dir = "www.easycn.net/";
$file = @ fopen($file_dir . $file_name,"r");
if (!$file) {
echo "文件找不到";
} else {
Header("Content-type: application/octet-stream");
Header("Content-Disposition: attachment; filename=" . $file_name);
while(!feof ($file)) {
echo fread($file,50000);
}
fclose ($file);
}
}
if($_POST["do"]=="yes"){
query();
}
?>
<input type="button" value="下载" onClick="javascript:cmdclick()">
<script type="text/javascript">
function cmdclick(){
document.location.href="?do=yes";
}
</script>
这样写应该不对,不知道怎样才能点击按钮调用php写的方法。。。我想实现的功能是点击按钮下载apk文件
求高受解决一下!不胜感激