Home >Backend Development >PHP Tutorial >PHP implements scanning QR code to access different download addresses according to browser type, PHP browser type_PHP tutorial
<?php $Agent = $_SERVER['HTTP_USER_AGENT']; preg_match('/android|iphone/i',$Agent,$matches); if (strtolower($matches[0]) == 'android') { // echo "安卓"; header("Location: ".$GLOBALS["public_appconfig"]["app"]['android']."'"); } elseif (strtolower($matches[0]) == 'iphone') { header("'Location: ".$GLOBALS["public_appconfig"]["app"]['ios']."'"); }else{ //不确定是什么系统或者是pc header("Location: ".$GLOBALS["public_appconfig"]["app"]['android']."'"); } ?>
Homepage You need to know that QR codes can be translated into some text or characters.
Process:
Generate a random verification string for a user, and then generate a QR code. When the user scans the QR code, it corresponds to the user, and then logs in to the user.
Of course, confidentiality and security measures must be paid attention to during this process.
Whether you can access it automatically depends on the function of the QR code scanning software installed on your mobile phone
Most QR code scanning software will automatically jump after reading the URL, and some will ask you whether to open it first