Heim  >  Artikel  >  Backend-Entwicklung  >  php实现扫描二维码根据浏览器类型访问不同下载地址,php浏览器类型_PHP教程

php实现扫描二维码根据浏览器类型访问不同下载地址,php浏览器类型_PHP教程

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

php实现扫描二维码根据浏览器类型访问不同下载地址,php浏览器类型

<&#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;>

常常看到网上二维码登录,问PHP程序中怎实现二维码登录?

首页你要知道二维码可以翻译成一些文字或者字符。
过程:
对一个用户生成一个随机验证字符串,然后生成二维码,当用户扫描二维码时对应到这个用户,然后登录该用户。

当然,在这个过程中要注意保密和安全措施。
 

怎实现扫描二维码,实现网址自动跳转?

能否自动访问就看你手机安装的二维码扫描软件的功能了
大部分二维码扫描软件读取到网址会自动跳转,有些会先询问你是否打开
 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/894133.htmlTechArticlephp实现扫描二维码根据浏览器类型访问不同下载地址,php浏览器类型 php$Agent = $_SERVER['HTTP_USER_AGENT'];preg_match('/android|iphone/i',$Agent,$matches);i...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn