Home > Backend Development > PHP Tutorial > 现下用什么技术识别是PC访问还是手机访问

现下用什么技术识别是PC访问还是手机访问

WBOY
Release: 2016-06-13 11:46:29
Original
919 people have browsed it

现在用什么技术识别是PC访问还是手机访问?
现在用什么技术识别是PC访问还是手机访问?如题
------解决方案--------------------
$ua = strtolower($_SERVER['HTTP_USER_AGENT']);

$uachar = "/(nokia
------解决方案--------------------
sony
------解决方案--------------------
ericsson
------解决方案--------------------
mot
------解决方案--------------------
samsung
------解决方案--------------------
sgh
------解决方案--------------------
lg
------解决方案--------------------
philips
------解决方案--------------------
panasonic
------解决方案--------------------
alcatel
------解决方案--------------------
lenovo
------解决方案--------------------
cldc
------解决方案--------------------
midp
------解决方案--------------------
mobile
------解决方案--------------------
ipad
------解决方案--------------------
iphone
------解决方案--------------------
android)/i";

if(($ua == '' 
------解决方案--------------------
 preg_match($uachar, $ua))&& !strpos(strtolower($_SERVER['REQUEST_URI']),'wap'))
{
        //手机访问 
header("Location: m.manshijian.com"); 
exit;
}else{
       //pc
}
------解决方案--------------------
http://www.16code.com/webapp-developer/

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template