: This article describes how to determine the mobile phone system of php. For more information about PHP tutorials, see. Scan the QR code to download the App. do you know how it works?
The scanned QR code is essentially a link, which executes a method to redirect to different App download platforms based on different mobile phone systems.
Header ("Content-type: text/html; charset = utf-8"); $ user_agent = $ _ SERVER ['http _ USER_AGENT ']; // return the mobile phone system and model information // var_dump ($ user_agent); if (stristr ($ _ SERVER ['http _ USER_AGENT '], 'Android ')) {// whether the Android keyword exists in the returned value // echo 'Your mobile phone is: Android system'; header ('Location: http: // xxx ');} else if (stristr ($ _ SERVER ['http _ USER_AGENT '], 'iPhone') {// echo 'Your mobile phone is: IOS system'; header ('Location: https: // xxx ');} else if (stristr ($ _ SERVER ['http _ USER_AGENT'], 'windowsphone ')) {// echo 'your system is WindowsPhone '; header ('Location: http: // xxx');} else {header ('Location: http: // xxx ');}
The above describes how to determine the mobile phone system of php, including the content, and hope to help friends who are interested in PHP tutorials.