Methods are as follows
Checks the user's agent string, which is part of the HTTP request sent by the browser. Use $_server[' http_user_agent '] to get the AGENT string information.
Like what:
<?php echo $_server[' http_user_agent '];? >
It is possible to print out this:
mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Encapsulated into functions:
function My_get_browser () {if (Empty ($_server[' http_user_agent ')) {return ' robot! '; if (false = = Strpos ($_server[' http_user_agent ', ' MSIE ')) && (Strpos ($_server[' http_user_agent '), ' Trident ' !==false) {return ' Internet Explorer 11.0 ';} if (False!==strpos ($_server[' http_user_agent '], ' MSIE 10.0 ') {return ' in ternet Explorer 10.0 '; } if (False!==strpos ($_server[' http_user_agent '), ' MSIE 9.0 ') {return ' Internet Explorer 9.0 ';} if (False!==strpos ($_ server[' http_user_agent '), ' MSIE 8.0 ') {return ' Internet Explorer 8.0 ';} if (False!==strpos ($_server[' Http_user_ AGENT '], ' MSIE 7.0 ') {return ' Internet Explorer 7.0 ';} if (False!==strpos ($_server[' http_user_agent '], ' MSIE 6.0 ')) {RET Urn ' Internet Explorer 6.0 '; } if (False!==strpos ($_server[' http_user_agent '), ' edge ') {return ' Edge ';} if (False!==strpos ($_server[' Http_user_ AGENT '], ' Firefox ') {return ' Firefox ';} if (False!==strpos ($_server[' http_user_agent '), ' Chrome ') {return ' Chrome ';} if (False!==strpos ($_server[' http_user_aGENT '], ' safari ') {return ' Safari ';} if (False!==strpos ($_server[' http_user_agent ', ' opera ')} {return ' opera ';} if ( False!==strpos ($_server[' http_user_agent '), ' 360SE ') {return ' 360SE ';} Browser if (False!==strpos ($_server[' http_user_agent '), ' Micromessage ')} {return ' Micromessage ';} }
Summarize
The above is the entire content of this article, I hope that the content of this article on everyone's study or work can bring certain help, if there is doubt you can message exchange.