Using php judge pc or mobile phone browser

isMobile function ()
{
// if it must be a mobile device HTTP_X_WAP_PROFILE
IF (isset ( Katex the parse error: Double subscript position AT 16: _SERVER [ 'HTTP_X_WAP_PROFILE'])) ... _SERVER [ 'HTTP_VIA']))
{
// Get is not flase, otherwise to true
return stristr ( Katex the parse error: the Expected 'the EOF', GOT '}' AT position 49: E ...: to false;} // brain damage method, determination ... _SERVER [ 'the HTTP_USER_AGENT']))
{
$ clientkeywords = Array ( 'Nokia',
'Sony',
'Ericsson',
'MOT',
'Samsung',
'HTC',
'SGH',
'LG',
'Sharp',
'sie-',
'Philips' ,
'Panasonic',
'Alcatel',
'Lenovo',
'iPhone',
'iPod',
'BlackBerry',
'Meizu',
'Android',
'NetFront',
'Symbian',
'UCWEB',
'WindowsCE',
'Palm',
'OperaMini',
'operamobi',
'Openwave',
'NexusOne ',
' CLDC ',
' MIDP ',
' wap ',
' Mobile '
);
// Find the mobile browser from HTTP_USER_AGENT keywords
. if (preg_match ( "/ ( " implode (' | ', c l i e n t k e Y w O r d s ) . " ) / i " , s t r t o l o w e r ( clientkeywords) . ")/i", strtolower( _SERVER [ 'the HTTP_USER_AGENT'])))
{
return to true;
}
}
// protocol method, because there may not be accurate, is determined into the final
IF (isset (Katex the parse error: the Expected '}', GOT 'the EOF' End of INPUT AT: ... IF ((the strpos (_SERVER [ 'HTTP_ACCEPT'], 'vnd.wap.wml') == to false) && (the strpos (! S E R V E R [ H T T P A C C E P T ] , t e x t m l ) = = = f a l s e ( s t r p o s ( _SERVER[&#x27;HTTP_ACCEPT&#x27;], &#x27;textml&#x27;) === false || (strpos( _SERVER[‘HTTP_ACCEPT’], ‘vnd.wap.wml’) < strpos($_SERVER[‘HTTP_ACCEPT’], ‘textml’))))
{
return true;
}
}
return false;
}

Guess you like

Origin blog.csdn.net/weixin_43365995/article/details/88950721