Tin tức

Code php nhân biết trình duyệt của các thiết bị Apple

function isIosDevice(){
    $userAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
    $iosDevice = array('iPhone', 'iPod', 'iPad', 'Macintosh');
    $isIos = false;

    foreach ($iosDevice as $val) {
        if(stripos($userAgent, $val) !== false){
            $isIos = true;
            break;
        }
    }

    return $isIos;
}
echo '<pre>';
print_r(isIosDevice());
echo '</pre>';
echo '<pre>';
print_r($_SERVER['HTTP_USER_AGENT']);
echo '</pre>';

Tin tức khác

Mã nguồn Web Ánh Linh 2021

Mã nguồn code web của Ánh Linh năm 2021 có những cập nhật gì mới?