php 用于检测是PC还是手机访问

<?php
$ua = strtolower($_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:跳转手机版本!‘));
}

?>

php 用于检测是PC还是手机访问,布布扣,bubuko.com

php 用于检测是PC还是手机访问

上一篇:string字符串转换为array(互换)


下一篇:苹果原生NSURLSession的上传和下载