Go.php
808 Bytes
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
<?php
use Action\AbstractAction;
/**
* 跳转
*/
class GoController extends AbstractAction
{
/**
* 跳转PC或WAP
*/
public function indexAction()
{
$pc = $this->get('pc', '//www.yohobuy.com');
$wap = $this->get('wap', '//m.yohobuy.com');
$pc = rawurldecode($pc);
$wap = rawurldecode($wap);
// 苹果设备
if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
$this->go($wap);
}
// 苹果IPAD
elseif (strstr($_SERVER['HTTP_USER_AGENT'], 'iPad')) {
$this->go($pc);
}
// 安卓设备
elseif (strstr($_SERVER['HTTP_USER_AGENT'], 'Android')) {
$this->go($wap);
}
// 其它
else {
$this->go($pc);
}
}
}