三合一好友码

今天看到有人发好友码了, 于是借鉴写了一下 (好几天没发文章了水一下), 原理和三合一收款码一样的, 都是判断浏览器 UA 标识进行跳转. 直接上代码吧

<?php
$qq="http://qm.qq.com/cgi-bin/qm/qr?k=sDXrqEhzrgw1pW2WmXXbnlov_RYEn8oT";
$zfb="https://qr.alipay.com/a7x04237kp9mzxrpezdr81a";
$wx="https://u.wechat.com/EJNs8aFYFn9wdaZMYeu7uAA";
$qrcodeApi="//api.oioweb.cn/qr/?m=5&e=L&p=10&url=";
$thisurl="http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
if (preg_match('/Alipay/i',$_SERVER['HTTP_USER_AGENT' ])) {
  header("Location: $zfb"); 
  exit;
} elseif (preg_match('/QQ\//i',$_SERVER['HTTP_USER_AGENT' ])) {
  header("Location: $qq"); 
  exit;
}
?>
<!DOCTYPE html><html lang="zh"><head><meta charset="UTF-8"/><meta name="viewport"content="width=device-width, initial-scale=1.0"/><meta http-equiv="X-UA-Compatible"content="ie=edge"/><title><?php if(preg_match('/MicroMessenger\//i',$_SERVER['HTTP_USER_AGENT'])){echo"微信好友"}else{echo"好友码"}?></title><style>body,html{height:100%;margin:0;font-size:16px}body{display:block}div{display:block}#color{background-color:rgb(84,188,110)}#code{width:100%}#ui-head{background-color:#fff;padding:10px 0;display:-webkit-box;width:100%;-webkit-box-align:center;-webkit-box-pack:center}#logo{width:55px;height:55px;background:url(<?php if(preg_match('/MicroMessenger\//i',$_SERVER['HTTP_USER_AGENT'])){echo"https://ww1.sinaimg.cn/large/006Fzy5igy1g1r01idi9wj308c08cq31.jpg"}else{echo"https://ww1.sinaimg.cn/large/006Fzy5igy1g1r0sy9kmkj30lq0ln758.jpg"}?>);background-size:100%100%;margin:5px;border-radius:30px}h2{font-weight:500}#ui-box{-webkit-box-flex:1;display:-webkit-box;width:100%;-webkit-box-align:center}#ui-tips{background-color:#fff;color:#46a638;font-size:18px;text-align:center;padding:5px 0;margin:40px auto;width:240px;border-radius:20px}#ui-qrcode{background-color:#fff;border-radius:15px;width:230px;height:230px;margin:0 auto;text-align:center}#qr-url{width:210px;height:210px;margin-top:10px}</style></head><body id="color"><div id="code"><div id="ui-head"><div id="logo"></div><h2><?php if(preg_match('/MicroMessenger\//i',$_SERVER['HTTP_USER_AGENT'])){echo"微信好友"}else{echo"好友码"}?></h2></div></div><div id="ui-box"><div id="ui-tips"><?php if(preg_match('/MicroMessenger\//i',$_SERVER['HTTP_USER_AGENT'])){echo"请长按二维码添加好友"}else{echo"请打开APP扫码"}?></div></div><div id="ui-qrcode"><img id="qr-url" src="<?php if (preg_match('/MicroMessenger\//i',$_SERVER['HTTP_USER_AGENT' ])) {echo" qrcodeApi="true" wx="true" else="true" echo="true" thisurl="true">"/></div></body></html>
自己用的话只修改:
$qq="http://qm.qq.com/cgi-bin/qm/qr?k=sDXrqEhzrgw1pW2WmXXbnlov_RYEn8oT";
$zfb="https://qr.alipay.com/a7x04237kp9mzxrpezdr81a";
$wx="https://u.wechat.com/EJNs8aFYFn9wdaZMYeu7uAA";

本博客所有文章如无特别注明均为原创。作者:^孤^痞^复制或转载请以超链接形式注明转自 我爱资源网 - 极品资源分享!
原文地址《三合一好友码
分享到:更多

相关推荐

发表评论

路人甲 表情
Ctrl+Enter快速提交

网友评论(0)