Home  >  Article  >  Backend Development  >  PHP implements scanning QR code to access different download addresses according to browser type, PHP browser type_PHP tutorial

PHP implements scanning QR code to access different download addresses according to browser type, PHP browser type_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:17:151109browse

php implements scanning QR code to access different download addresses according to browser type, php browser type

<&#63;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']."'");
}
&#63;>

I often see QR code login online and ask how to implement QR code login in PHP program?

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.

How to scan the QR code and automatically redirect the website?

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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/894133.htmlTechArticlephp implements scanning QR code to access different download addresses according to browser type, php browser type php$Agent = $ _SERVER['HTTP_USER_AGENT'];preg_match('/android|iphone/i',$Agent,$matches);i...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn