admin管理员组文章数量:1130349
<?php
header("Content-Type:text/html; charset=utf-8");
if(get_device_type()=='ios'){
$ff='huanbaoba.ipa';
header('application/iphone');
header('Content-Disposition:attachment;filename="huanbaoba.ipa"');
}else{
$ff='huanbaoba.apk';
header('application/vnd.android.package-archive');
header('Content-Disposition:attachment;filename="huanbaoba.apk"');
}
readfile($ff);
function get_device_type(){
$agent = strtolower($_SERVER['HTTP_USER_AGENT']);
$type = 'other';
if(strpos($agent, 'iphone') || strpos($agent, 'ipad')){
$type = 'ios';
}
if(strpos($agent, 'android')){
$type = 'android';
}
return $type;
}
安卓已经测试通过了
ios未测试
<?php
header("Content-Type:text/html; charset=utf-8");
if(get_device_type()=='ios'){
$ff='huanbaoba.ipa';
header('application/iphone');
header('Content-Disposition:attachment;filename="huanbaoba.ipa"');
}else{
$ff='huanbaoba.apk';
header('application/vnd.android.package-archive');
header('Content-Disposition:attachment;filename="huanbaoba.apk"');
}
readfile($ff);
function get_device_type(){
$agent = strtolower($_SERVER['HTTP_USER_AGENT']);
$type = 'other';
if(strpos($agent, 'iphone') || strpos($agent, 'ipad')){
$type = 'ios';
}
if(strpos($agent, 'android')){
$type = 'android';
}
return $type;
}
安卓已经测试通过了
ios未测试
版权声明:本文标题:php识别访问手机操作系统,并直接下载相应的安装包 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/jiaocheng/1740324154a1751874.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论