recent projects, to determine whether the user's mobile phone is Android or iOS, search the relevant information, the final results obtained. It turns out that it's effective! The main thing is to use the http_user_agent, which means the code used to check the browser (including version number) and user preferences of the visitor on the browsing page.
The monitoring code is as follows:
function Get_device_type ()
{
All into lowercase letters
$agent = Strtolower ($_server[' http_user_agent ');
$type = ' other ';
To judge separately.
if (Strpos ($agent, ' iphone ') | | strpos ($agent, ' ipad '))
{
$type = ' iOS ';
}
if (Strpos ($agent, ' Android '))
{
$type = ' Android ';
}
return $type;
}
By calling this function, you can get the type of the phone.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
PHP to determine whether the phone is an Android or iOS system