Index.php 1.82 KB
<?php

class IndexController extends QLib_Actions_Default
{

    public function indexAction()
    {
        $ua = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
        $uachar = "/(iphone|android|phone|mobile|wap|netfront|java|opera mobi|opera mini|ucweb|windows ce|symbian|series|webos|sony|blackberry|dopod|nokia|samsung|palmsource|xda|pieplus|meizu|midp|cldc|motorola|foma|docomo|up.browser|up.link|blazer|helio|hosin|huawei|novarra|coolpad|webos|techfaith|palmsource|alcatel|amoi|ktouch|nexian|ericsson|philips|sagem|wellcom|bunjalloo|maui|smartphone|iemobile|spice|bird|zte-|longcos|pantech|gionee|portalmmm|jig browser|hiptop|benq|haier|^lct|320x320|240x320|176x220)/i";
        if (($ua == '' || preg_match($uachar, $ua)) && !strpos(strtolower($_SERVER['REQUEST_URI']), 'wap')) {
            exit(header('location:' . $this->domain . 'index/mobile'));
        }
    }

    public function mobileAction()
    {
        //校验是否是微信访问, 微信访问使用页面,否则直接跳转到下载页
        if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && (false !== strstr($_SERVER['HTTP_X_REQUESTED_WITH'], 'com.tencent.mm')) && (false !== stristr($_SERVER['HTTP_USER_AGENT'], 'android'))) {
            exit(header('location:' . $this->domain . 'index/weixin'));
        } else {
        }

    }

    public function weixinAction()
    {
        $ua = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
        //校验是否是微信访问, 微信访问使用页面,否则直接跳转到下载页
        if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && (false !== strstr($_SERVER['HTTP_X_REQUESTED_WITH'], 'com.tencent.mm')) && (false !== stristr($_SERVER['HTTP_USER_AGENT'], 'android'))) {
        } else {
            exit(header('location:' . $this->domain . 'index/mobile'));
        }
    }

}