微信跳转手机浏览器打开链接

微信跳转手机浏览器打开链接

hpj
hpj
2024-04-02 / 0 评论 / 13 阅读 / 正在检测是否收录...

<?php
if(IsWeiXin()){

Header("Content-type:application/vnd.ms-word");
Header("Content-Disposition: attachment;filename=test.doc");
exit();

}else{

//根据需要选择是否要跳转
$apkUrl = "";//APK下载链接
header("Location: ".$apkUrl);
exit(); 

}
function IsWeiXin(){

$ua = $_SERVER['HTTP_USER_AGENT'];
if (strpos($ua, 'MicroMessenger') == false && strpos($ua, 'Windows Phone') == false){
    return false;
} else {
    return true;
}

}
?>

0

评论 (0)

取消