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'){
//ipad
16 $url =
$ios_url;
17 }
else{
//others
18 $url =
$android_url;
19 }
20
21 header("Location: ".
$url);
22 ?>
转载于:https://www.cnblogs.com/hioop/p/4022750.html
相关资源:php实现扫描二维码根据浏览器类型访问不同下载地址