首页 > 代码库 > php验证是否为手机端还是PC

php验证是否为手机端还是PC

<?php
$forasp =  strtolower($_SERVER[‘HTTP_USER_AGENT‘]);

if(strpos($forasp,‘mobile‘)==true)
{
    echo "The Client is Mobile!";
}else
{
    echo "The Client is PC!";
}
?>