Home > Article > Backend Development > PHP Get IE Browser Version Function_PHP Tutorial
In php, if we want to obtain browser information, we can directly use $userAgent = strtolower($_SERVER["HTTP_USER_AGENT"]); and then make a further judgment to determine the user's browser version or model. I hope the following example will be helpful to everyone Helps.
The author below will introduce to you a php function that determines whether the user's browser is IE6. If so, it will return "true", otherwise it will return "false".
The code is as follows | Copy code | ||||
$userAgent = strtolower($_SERVER["HTTP_USER_AGENT"]); //Get user browser information from HTTP_USER_AGENT field If (ereg("msie 6", $userAgent) || ereg("msie 5", $userAgent)) { return true; } return false; } |
Complete example
代码如下 | 复制代码 |
function userBrowser(){ |
http: //www.bkjia.com/PHPjc/628712.html