Go.php 808 Bytes
<?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);
        }
    }

}