1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
public
function
order_source()
{
$useragent
=
strtolower
(
$_SERVER
[
"HTTP_USER_AGENT"
]);
// 微信
$is_weixin
=
strripos
(
$useragent
,
'micromessenger'
);
if
(
$is_weixin
){
//echo '微信'; exit;
echo
'<script language="javascript" type="text/javascript"> window.location.href="https://www.xxx.com"; </script>'
;
exit
;
}
// iphone
$is_iphone
=
strripos
(
$useragent
,
'iphone'
);
if
(
$is_iphone
){
$this
->display(
"Codes/ios"
);
echo
'<script language="javascript" type="text/javascript"> window.location.href="https://www.xxx.com"; </script>'
;
exit
;
}
// android
$is_android
=
strripos
(
$useragent
,
'android'
);
if
(
$is_android
){
$this
->display(
"Codes/android"
);
echo
'<script language="javascript" type="text/javascript"> window.location.href="https://www.xxx.com"; </script>'
;
exit
;
}
// ipad
$is_ipad
=
strripos
(
$useragent
,
'ipad'
);
if
(
$is_ipad
){
echo
'ipad'
;
exit
;
}
// ipod
$is_ipod
=
strripos
(
$useragent
,
'ipod'
);
if
(
$is_ipod
){
echo
'ipod'
;
exit
;
}
// pc电脑
$is_pc
=
strripos
(
$useragent
,
'windows nt'
);
if
(
$is_pc
){
echo
'pc'
;
exit
;
}
echo
'other'
;
}
|
本文转自噼里啪啦啦 51CTO博客,原文链接:http://blog.51cto.com/pilipala/1981332
,如需转载请自行联系原作者