preface
analysis
Start tossing
<? php $ua = $_SERVER['HTTP_USER_AGENT']; if (strpos($ua, 'MicroMessenger')) { $type = 'wepay'; $name='WeChat payment'; //WeChat payment link $url = ' wxp://f2f09hjzo72AAYEITIBaolV-3cvGrDjE0q7k '; $icon_img = '<img src=" https://sangsir.com/usr/uploads/sina/5e834b9da7b25.jpg " width="48px" height="48px" alt="'.$ name.' ">'; } elseif (strpos($ua, 'AlipayClient')) { //Alipay link $url = 'HTTPS://QR. ALIPAY. COM/FKX03479QJ0RVOS3UJLQAE'; header('location: ' . $url); } elseif (strpos($ua, 'QQ/')) { $type = 'qq'; $name='QQ wallet payment'; //QQ wallet payment link $url = ' https://i.qianbao.qq.com/wallet/sqrcode.htm?m=tenpay&a=1&u=17878127&ac=E04BE442991E7FFED28B3B5C3E187148F063DC3C6DACAD2983C87B482FC9E7AD&n= Schrodinger's Cat&f=wallet '; $icon_img = '<img src=" https://sangsir.com/usr/uploads/sina/5e834b9f9dd09.jpg " width="48px" height="48px" alt="'.$ name.' ">'; } else { $type = 'other'; $name='Reward the author'; $url = 'http://'.$_ SERVER['HTTP_HOST'].$_ SERVER['REQUEST_URI']; $icon_img = '<img src=" https://sangsir.com/usr/uploads/sina/5e834ba0ae5f8.jpg " width="48px" height="48px" alt="'.$ name.' ">'; } $qr_img = '<img src=" http://qr.liantu.com/api.php?text= '.urlencode($url).' ">'; ?> <! DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="renderer" content="webkit"> <meta http-equiv="X-UA-Compatible" content="IE=Edge, chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title><?=$ name?></ title> <style type="text/css"> * {margin: auto;padding: 0;border: 0;} html {-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%} body {font-family: -apple-system, SF UI Text, Arial, Microsoft YaHei, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif;color: #333;} img {max-width: 100%;} h3 {padding: 10px;} .container {text-align: center;} .title {padding: 2em 0;background-color: #fff;} .content {padding: 2em 1em;color: #fff;} .wepay {background-color: #23ac38;} .qq {background-color: #4c97d5;} .other {background-color: #ff7055;} </style> </head> <body class="<?=$type?>"> <div class="container"> <div class="title"><?=$ icon_img?>< h1><?=$ name?></ h1></div> <div class="content"><?=$ type=='other'?$ qr_img.'< H3>Please use Alipay, WeChat and QQ clients to scan the code for payment</h3>': $qr_img.'< H3>Scan or long press the QR code to pay TA</h3>'?></ div> </div> </body> </html>
Demo Demo