首页 > 学院 > 开发设计 > 正文

扫描同一个二维码根据浏览器类型访问不同下载地址

2019-11-15 01:51:06
字体:
来源:转载
供稿:网友
扫描同一个二维码根据浏览器类型访问不同下载地址
 1 <?php  2     // 获取手机设备类型,访问同一地址 根据不同设备跳转到不同地址; 可用于扫描二维码,app下载, 3     $Agent = $_SERVER['HTTP_USER_AGENT']; 4  5     PReg_match('/android|iphone|ipad/i',$Agent,$matches); 6  7     $device = strtolower($matches[0]); 8     $ios_url ="http://www.hioop.net/ios/"; 9     $android_url = "http://www.hioop.net/android/";10 11     if ( $device == 'android')  {       //安卓12         $url = $android_url;13     } elseif ( $device == 'iphone') {    //iphone   14         $url = $ios_url;15     }elseif ( $device == 'ipad'){       //ipad16         $url = $ios_url;17     } else{                             //others18         $url = $android_url;19     }20     21     header("Location: ".$url);22  ?>


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表