Home >Backend Development >PHP Tutorial >PHP code to determine whether mobile phone access
PHP detects whether the client user has mobile access. The code is very simple. Friends in need can refer to it.
The code is as follows: <?php //php判断客户端是否为手机 $agent = $_SERVER['HTTP_USER_AGENT']; if(strpos($agent,"NetFront") || strpos($agent,"iPhone") || strpos($agent,"MIDP-2.0") || strpos($agent,"Opera Mini") || strpos($agent,"UCWEB") || strpos($agent,"Android") || strpos($agent,"Windows CE") || strpos($agent,"SymbianOS")) header("Location:xxxxxxxx"); ?> You can also refer to:php js code to determine whether mobile phone access |