iBegins
 

Code check nhận diện hệ điều hành trình duyệt di động PHP

//Detect special conditions devices
$iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");
$Android = stripos($_SERVER['HTTP_USER_AGENT'],"Android");
$webOS = stripos($_SERVER['HTTP_USER_AGENT'],"webOS");

//do something with this information
if( $iPod || $iPhone ){
//browser reported as an iPhone/iPod touch -- do something here
}else if($iPad){
//browser reported as an iPad -- do something here
}else if($Android){
//browser reported as an Android device -- do something here
}else if($webOS){
//browser reported as a webOS device -- do something here
}
 

Code kiểm tra đang truy cập trên hệ điều hành gì trên website !
Bạn gắn code trên vào đâu phù hợp nhất để test nhé !

Ngày 8 Tháng Ba, 2019 ( 942 )

Tagged with: , , , ,

Bình luận bài viết

Đăng nhập để bình luận và xem các bình luận khác.