{"id":10006122,"date":"2022-08-06T22:05:29","date_gmt":"2022-08-06T14:05:29","guid":{"rendered":"https:\/\/ityet.com\/?p=10006122"},"modified":"2022-08-06T22:05:29","modified_gmt":"2022-08-06T14:05:29","slug":"%e9%80%9a%e8%bf%87%e5%b0%8f%e7%a8%8b%e5%ba%8f%e5%ae%9e%e7%8e%b0%e5%be%ae%e4%bf%a1%e6%89%ab%e7%a0%81%e7%99%bb%e5%bd%95%ef%bc%8c%e4%b8%aa%e4%ba%ba%e7%bd%91%e7%ab%99%e6%8e%a5%e5%85%a5%e5%be%ae%e4%bf%a1","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10006122","title":{"rendered":"\u901a\u8fc7\u5c0f\u7a0b\u5e8f\u5b9e\u73b0\u5fae\u4fe1\u626b\u7801\u767b\u5f55\uff0c\u4e2a\u4eba\u7f51\u7ad9\u63a5\u5165\u5fae\u4fe1\u626b\u7801\u767b\u5f55\u529f\u80fd"},"content":{"rendered":"<h2>\u9700\u6c42<\/h2>\n<p>\u7f51\u7ad9\u5982\u679c\u60f3\u8981\u5b9e\u73b0\u5fae\u4fe1\u626b\u7801\u767b\u5f55\u5176\u5b9e\u6709\u5f88\u591a\u79cd\u65b9\u6848\uff0c\u5e38\u89c1\u7684\u65b9\u6848\u5c31\u662f\u5fae\u4fe1\u5f00\u653e\u5e73\u53f0\u548c\u5fae\u4fe1\u516c\u4f17\u53f7\u670d\u52a1\u53f7\u3002\u524d\u8005\u662f\u76ee\u524d\u5927\u90e8\u5206\u7f51\u7ad9\u5e76\u4e14\u662f\u5fae\u4fe1\u8ba4\u53ef\u7684\u4e00\u79cd\u65b9\u5f0f\uff0c\u540e\u8005\u662f\u5f00\u53d1\u8005\u53d1\u73b0\u670d\u52a1\u53f7\u5177\u5907\u626b\u7801\u5173\u6ce8\u540e\u5373\u53ef\u83b7\u53d6\u7528\u6237\u57fa\u672c\u4fe1\u606f\u7684\u80fd\u529b\u540e\u800c\u5f00\u53d1\u7684\u4e00\u79cd\u65b9\u5f0f\u3002<\/p>\n<p>\u800c\u8fd9\u4e24\u8005\u5176\u5b9e\u90fd\u662f\u9700\u8981\u5177\u5907\u8d44\u8d28\uff0c\u4f8b\u5982\u8ba4\u8bc1\uff0c\u5bf9\u4e8e\u4e2a\u4eba\u5f00\u53d1\u8005\u6765\u8bf4\uff0c\u662f\u6709\u4e00\u5b9a\u7684\u95e8\u69db\u7684\uff0c\u800c\u6211\u8fd9\u6b21\u5206\u4eab\u7684\u662f0\u95e8\u69db\u7684\uff0c\u4e2a\u4eba\u5f00\u53d1\u8005\u4e00\u6837\u53ef\u4ee5\u5b9e\u73b0\u3002<\/p>\n<h2>\u539f\u7406<\/h2>\n<p>\u5c0f\u7a0b\u5e8f\u4e5f\u662f\u5177\u5907\u83b7\u53d6\u7528\u6237\u57fa\u672c\u4fe1\u606f\u7684\u80fd\u529b\u7684\uff0c\u53ef\u4ee5\u8c03\u7528<code>wx.login\u63a5\u53e3<\/code>\u83b7\u53d6\u7528\u6237\u7684openid\u5b9e\u73b0\u767b\u5f55\u3002\u7b80\u5355\u6765\u8bf4\u5c31\u662fweb\u7aef\u521b\u5efa\u4e00\u4e2a\u5e26\u53c2\u6570\u7684\u4e8c\u7ef4\u7801\u540c\u65f6\u5411\u6570\u636e\u5e93\u63d2\u5165\u4e00\u6761\u767b\u5f55\u8bb0\u5f55\uff0c\u6b64\u65f6web\u7aef\u5df2\u7ecf\u5f00\u59cb\u8f6e\u8be2\u6570\u636e\u5e93\u8fd9\u6761\u8bb0\u5f55\u7684\u626b\u7801\u72b6\u6001\u4e86\uff0c\u5fae\u4fe1\u626b\u7801\u540e\u6253\u5f00\u5c0f\u7a0b\u5e8f\u5e76\u7acb\u5373\u83b7\u53d6\u5230\u8fd9\u4e2a\u53c2\u6570\uff0c\u7136\u540e\u70b9\u51fb\u6388\u6743\u767b\u5f55\u6309\u94ae\u8bf7\u6c42wx.login\u8fd9\u4e2a\u63a5\u53e3\u83b7\u53d6\u5230openid\uff0c\u7136\u540e\u5c06openid\u66f4\u65b0\u81f3\u6570\u636e\u5e93\u8fd9\u4e2a\u767b\u5f55\u8bb0\u5f55\u4e2d\u5e76\u66f4\u65b0\u626b\u7801\u72b6\u6001\uff0cweb\u7aef\u53ef\u4ee5\u8f6e\u8be2\u5230\u767b\u5f55\u6210\u529f\u7684\u72b6\u6001\u7801\u5c31\u5c55\u793a\u767b\u5f55\u6210\u529f\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc1yW2\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h2>\u4ee3\u7801<\/h2>\n<p>creatqrcode.php<\/p>\n<pre><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n&lt;head&gt;\n    &lt;title&gt;\u5c0f\u7a0b\u5e8f\u626b\u7801\u767b\u5f55\u793a\u4f8b&lt;\/title&gt;\n    &lt;meta charset=&quot;utf-8&quot;&gt;\n    &lt;script type=&quot;text\/javascript&quot; src=&quot;.\/jquery.min.js&quot;&gt;&lt;\/script&gt;\n    &lt;link rel=&quot;stylesheet&quot; type=&quot;text\/css&quot; href=&quot;.\/bootstrap.min.css&quot;&gt;\n    &lt;style&gt;\n        *{\n            padding:0;\n            margin:0;\n        }\n        #xcxqrcode{\n            width: 200px;\n            height: 200px;\n            margin:50px auto;\n            display: block;\n        }\n        #lgtext{\n            text-align: center;\n            padding:20px 20px;\n            background: #f1f1f1;\n            border-radius: 100px;\n        }\n        #openid{\n            text-align: center;\n            padding:20px 20px;\n        }\n    &lt;\/style&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n&lt;?php\n\/\/ Header\nheader(&quot;Content-type:text\/html;charset=utf-8&quot;);\n\n\/\/ \u83b7\u53d6access_token\nfunction getToken(){\n    \/**\n     * \u8fd9\u91cc\u66ff\u6362\u4e3a\u4f60\u7684\u5c0f\u7a0b\u5e8f\u7684appid\u548cappsecret\n     *\/\n    $appid='xxx';\n    $appsecret='xxx';\n    \/\/ \u8bfb\u53d6access_token\n    include 'access_token.php';\n    \/\/ \u5224\u65ad\u662f\u5426\u8fc7\u671f\n    if (time() &gt; $access_token['expires']){\n        \/\/ \u5982\u679c\u5df2\u7ecf\u8fc7\u671f\u5c31\u5f97\u91cd\u65b0\u83b7\u53d6\u5e76\u7f13\u5b58\n        $access_token = array();\n        $access_token['access_token'] = getNewToken($appid,$appsecret);\n        $access_token['expires']=time()+7000;\n        \/\/ \u5c06\u6570\u7ec4\u5199\u5165php\u6587\u4ef6\n        $arr = '&lt;?php'.PHP_EOL.'$access_token = '.var_export($access_token,true).';'.PHP_EOL.'?&gt;';\n        $arrfile = fopen(&quot;.\/access_token.php&quot;,&quot;w&quot;);\n        fwrite($arrfile,$arr);\n        fclose($arrfile);\n        \/\/ \u8fd4\u56de\u5f53\u524d\u7684access_token\n        return $access_token['access_token'];\n\n    }else{\n        \/\/ \u5982\u679c\u6ca1\u6709\u8fc7\u671f\u5c31\u76f4\u63a5\u8bfb\u53d6\u7f13\u5b58\u6587\u4ef6\n        return $access_token['access_token'];\n    }\n}\n\n\/\/ \u83b7\u53d6\u65b0\u7684access_token\nfunction getNewToken($appid,$appsecret){\n    $url = &quot;https:\/\/api.weixin.qq.com\/cgi-bin\/token?grant_type=client_credential&amp;appid={$appid}&amp;secret={$appsecret}&quot;;\n    $access_token_Arr =  https_request($url);\n    return $access_token_Arr['access_token'];\n}\n\n\/\/ curl\u8bf7\u6c42\u51fd\u6570\nfunction https_request ($url){\n    $ch = curl_init();\n    curl_setopt($ch, CURLOPT_URL, $url);\n    curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);\n    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n    $out = curl_exec($ch);\n    curl_close($ch);\n    return  json_decode($out,true);\n}\n\n\/\/ \u521b\u5efa\u5c0f\u7a0b\u5e8f\u7801\nfunction creatQrcode(){\n    \/\/ \u8bf7\u6c42\u5c0f\u7a0b\u5e8f\u63a5\u53e3\u521b\u5efa\u5c0f\u7a0b\u5e8f\u7801\n    $ch = curl_init();\n    curl_setopt($ch, CURLOPT_URL, 'https:\/\/api.weixin.qq.com\/wxa\/getwxacodeunlimit?access_token='.getToken());\n    curl_setopt($ch, CURLOPT_POST, true);\n    $sc = uniqid(); \/\/ \u751f\u6210scene\n    $data = array(\n        &quot;scene&quot; =&gt; $sc,\n        &quot;env_version&quot; =&gt; &quot;develop&quot; \/\/ \u5c0f\u7a0b\u5e8f\u5ba1\u6838\u901a\u8fc7\u540e\u9700\u8981\u4fee\u6539\u53c2\u6570\u4e3arelease\n    );\n    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));\n    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);\n    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n    $result = curl_exec($ch);\n    \/\/ \u56fe\u7247buffer\u8f6c\u672c\u5730\u56fe\u7247\n    $img = file_put_contents($sc.'.png', $result);\n    \/\/ \u5f15\u5165\u6570\u636e\u5e93\u914d\u7f6e\n    include '.\/Db.php';\n    \/\/ \u5c06\u4e8c\u7ef4\u7801\u7684scene\u5199\u5165\u6570\u636e\u5e93\n    $add_scene = &quot;INSERT INTO xcxqrcodelogin (scene) VALUES ('$sc')&quot;;\n    if ($conn-&gt;query($add_scene) === TRUE) {\n        $file = $sc.'.png';\n        if($fp = fopen($file,&quot;rb&quot;, 0)) \n        { \n            $gambar = fread($fp,filesize($file)); \n            fclose($fp);\n            $base64_qrcode = 'data:image\/jpg\/png\/gif;base64,'.chunk_split(base64_encode($gambar)); \n            \/\/ \u4ee5JSON\u7684\u65b9\u5f0f\u8fd4\u56de\u5c0f\u7a0b\u5e8f\u7801\u53cascene\n            return json_encode(array('xcxqrcode'=&gt;$base64_qrcode,'scene'=&gt;$sc));\n        }\n    }\n    \/\/ \u65ad\u5f00\u8fde\u63a5\n    curl_close($ch);\n    $conn-&gt;close();\n}\n\n?&gt;\n\n&lt;!-- \u83b7\u53d6\u5230\u5c0f\u7a0b\u5e8f\u7801\u7684base64\u6570\u636e --&gt;\n&lt;?php \n    $qrcodebase64json = json_decode(creatQrcode());\n    $xcxqrcode = $qrcodebase64json-&gt;xcxqrcode;\n    $scene = $qrcodebase64json-&gt;scene;\n    \/\/ \u5220\u9664\u672c\u5730\u7684\u56fe\u7247\n    unlink('.\/'.$scene.'.png');\n?&gt;\n&lt;!-- \u5c55\u793a\u4e8c\u7ef4\u7801\u53ca\u626b\u7801\u7ed3\u679c --&gt;\n&lt;div style=&quot;width:300px;margin:50px auto;&quot;&gt;\n    &lt;img src=&quot;&lt;?php echo $xcxqrcode; ?&gt;&quot; id=&quot;xcxqrcode&quot;&gt;\n    &lt;input type=&quot;hidden&quot; value=&quot;&lt;?php echo $scene; ?&gt;&quot; id=&quot;sc&quot;\/&gt;\n    &lt;h4 id=&quot;lgtext&quot;&gt;\u8bf7\u4f7f\u7528\u5fae\u4fe1\u626b\u7801&lt;\/h4&gt;\n    &lt;p id=&quot;openid&quot;&gt;&lt;\/p&gt;\n&lt;\/div&gt;\n\n&lt;!-- \u8f6e\u8be2\u626b\u7801\u7ed3\u679c --&gt;\n&lt;script type=&quot;text\/javascript&quot;&gt;\n\n\/\/ \u4ece0\u79d2\u5f00\u59cb\u8f6e\u8be2\nlet TimeOut = 0;\nlet checklogin = setInterval('CheckStatus()', 1000);\n\n\/\/ \u67e5\u8be2\u626b\u7801\u72b6\u6001\nfunction CheckStatus() {\n    \/\/ \u83b7\u53d6scene\n    var sc = $('#sc').val();\n    $.ajax({\n        type: &quot;POST&quot;,\n        url: &quot;.\/getstatus.php?scene=&quot;+sc,\n        success:function(data){\n            \/\/ code==200\u5373\u6388\u6743\u767b\u5f55\u6210\u529f\n            if (data.code == 200) {\n                console.log(data.msg)\n                $('#lgtext').html('&lt;span style=&quot;color:#07c160;&quot;&gt;'+data.msg+'&lt;\/span&gt;')\n                $('#openid').text(data.openid)\n                $('#xcxqrcode').css('filter','blur(5px)')\n                clearTimeout(checklogin);\n            }else{\n                console.log(data.msg)\n                if(data.code == 201){\n                    $('#lgtext').html('&lt;span style=&quot;color:#666;&quot;&gt;'+data.msg+'&lt;\/span&gt;')\n                }else if(data.code == 202){\n                    $('#lgtext').html('&lt;span style=&quot;color:#07c160;&quot;&gt;'+data.msg+'&lt;\/span&gt;')\n                }\n            }\n            guoqi();\n        },\n        error:function(data) {\n          console.log('\u670d\u52a1\u5668\u53d1\u751f\u9519\u8bef')\n          $('#lgtext').text('\u670d\u52a1\u5668\u53d1\u751f\u9519\u8bef')\n        }\n    });\n}\n\n\/\/ \u5c0f\u7a0b\u5e8f\u7801\u8fc7\u671f\u68c0\u6d4b\nfunction guoqi(){\n    TimeOut += 1;\n    \/\/ 60\u79d2\u540e\u8fc7\u671f\n    if(TimeOut &gt;= 60){\n        \/\/ \u8fc7\u671f\u540e\u505c\u6b62\u8f6e\u8be2\n        clearTimeout(checklogin);\n        $('#lgtext').text('\u5df2\u8fc7\u671f\uff0c\u8bf7\u5237\u65b0\u9875\u9762')\n        $('#xcxqrcode').css('filter','blur(5px)')\n    }\n}\n\n&lt;\/script&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n<p>getstatus.php<\/p>\n<pre><code>&lt;?php\nheader(&quot;Content-type:application\/json&quot;);\n\n\/\/ \u5c0f\u7a0b\u5e8f\u626b\u7801\u540e\u89e3\u6790\u5c0f\u7a0b\u5e8f\u7801\u83b7\u53d6\u5230\u7684scene\n$scene = $_GET['scene'];\n\n\/\/ \u5f15\u5165\u6570\u636e\u5e93\u914d\u7f6e\ninclude '.\/Db.php';\n\n\/\/ \u67e5\u8be2\u5f53\u524dscene\u7684\u626b\u7801\u72b6\u6001\n$getstatusinfo = &quot;SELECT * FROM xcxqrcodelogin WHERE scene='$scene'&quot;;\n$result_statusinfo = $conn-&gt;query($getstatusinfo);\n\n\/\/ \u5982\u679cscene\u5b58\u5728\nif ($result_statusinfo-&gt;num_rows &gt; 0) {\n    while($row_statusinfo = $result_statusinfo-&gt;fetch_assoc()) {\n        $status = $row_statusinfo['status'];\n        $openid = $row_statusinfo['openid'];\n    }\n    \/\/ \u5f53scene=1\u7684\u65f6\u5019\u4ee3\u8868\u8fd8\u6ca1\u626b\u7801\n    if($status == '1'){\n        $ret = array(\n            'code' =&gt; 201,\n            'msg' =&gt; '\u8bf7\u4f7f\u7528\u5fae\u4fe1\u626b\u7801'\n        );\n    }else if($status == '2'){\n        \/\/ \u5f53scene=2\u7684\u65f6\u5019\u4ee3\u8868\u5df2\u626b\u7801\u672a\u767b\u5f55\n        $ret = array(\n            'code' =&gt; 202,\n            'msg' =&gt; '\u5df2\u626b\u7801\uff0c\u8bf7\u6388\u6743\u767b\u5f55'\n        );\n    }else if($status == '3'){\n        \/\/ \u5f53scene=3\u7684\u65f6\u5019\u4ee3\u8868\u5df2\u767b\u5f55\n        $ret = array(\n            'code' =&gt; 200,\n            'msg' =&gt; '\u767b\u5f55\u6210\u529f',\n            'openid' =&gt; $openid\n        );\n    }\n}else{\n    $ret = array(\n        'code' =&gt; 203,\n        'msg' =&gt; '\u8bf7\u5237\u65b0\u91cd\u8bd5'\n    );\n}\n\n\/\/ \u65ad\u5f00\u6570\u636e\u5e93\u8fde\u63a5\n$conn-&gt;close();\n\n\/\/ \u8f93\u51fa\u7ed3\u679c\necho json_encode($ret,JSON_UNESCAPED_UNICODE);\n\n?&gt;<\/code><\/pre>\n<p>scanCode.php<\/p>\n<pre><code>&lt;?php\n\/**\n * \u544a\u8bc9\u6570\u636e\u5e93\u6211\u5df2\u7ecf\u626b\u7801\u4e86\n *\/\nheader(&quot;Content-type:application\/json&quot;);\n$scene = $_GET['scene'];\n\/\/ \u5f15\u5165\u6570\u636e\u5e93\u914d\u7f6e\ninclude '.\/Db.php';\nmysqli_query($conn,&quot;UPDATE xcxqrcodelogin SET status='2' WHERE scene='$scene'&quot;);\n$conn-&gt;close();\n?&gt;<\/code><\/pre>\n<p>login.php<\/p>\n<pre><code>&lt;?php\nheader(&quot;content-type:application\/json&quot;);\n\n\/\/ \u901a\u8fc7wx.login\u83b7\u53d6\u5230\u7684code\n$code = $_GET[&quot;code&quot;];\n$scene = $_GET['scene'];\n\n\/**\n * \u8fd9\u91cc\u66ff\u6362\u4e3a\u4f60\u7684\u5c0f\u7a0b\u5e8f\u7684appid\u548cappsecret\n *\/\n$appid = &quot;xxx&quot;;\n$secret = &quot;xxx&quot;;\n\n\/\/ \u8bf7\u6c42\u63a5\u53e3\u8fdb\u884c\u767b\u5f55\u83b7\u53d6\u5230openid\n$api = &quot;https:\/\/api.weixin.qq.com\/sns\/jscode2session?appid=$appid&amp;secret=$secret&amp;js_code=$code&amp;grant_type=authorization_code&quot;;\n$result = file_get_contents($api);\n$arr_result = json_decode($result, true);\n$openid = $arr_result[&quot;openid&quot;];\n\n\/\/ \u5f15\u5165\u6570\u636e\u5e93\u914d\u7f6e\ninclude '.\/Db.php';\n\/\/ \u66f4\u65b0\u767b\u5f55\u72b6\u6001\nmysqli_query($conn,&quot;UPDATE xcxqrcodelogin SET openid='$openid',status='3' WHERE scene='$scene'&quot;);\n$ret = array(\n    'code' =&gt; 200,\n    'msg' =&gt; '\u767b\u5f55\u6210\u529f',\n    'openid' =&gt; $openid\n);\n$conn-&gt;close();\n\n\/\/ \u8fd4\u56de\u7ed3\u679c\necho json_encode($ret,JSON_UNESCAPED_UNICODE);\n?&gt;<\/code><\/pre>\n<p>Db.php<\/p>\n<pre><code>&lt;?php\n\n\/**\n * \u6570\u636e\u5e93\u914d\u7f6e\n * BY TANKING 2022-08-06\n * https:\/\/segmentfault.com\/u\/tanking\n *\/\n$db_url = &quot;XXX&quot;; \/\/ \u6570\u636e\u5e93\u670d\u52a1\u5668\u5730\u5740\n$db_user = &quot;XXX&quot;; \/\/ \u6570\u636e\u5e93\u8d26\u53f7\n$db_pwd = &quot;XXX&quot;; \/\/ \u6570\u636e\u5e93\u8d26\u53f7\n$db_name = &quot;XXX&quot;; \/\/ \u6570\u636e\u5e93\u540d\u79f0\n\n\/\/ \u8fde\u63a5\u6570\u636e\u5e93\n$conn = new mysqli($db_url, $db_user, $db_pwd, $db_name);\nmysqli_query($conn, &quot;SET NAMES UTF-8&quot;);\n\n?&gt;<\/code><\/pre>\n<h2>\u4ee3\u7801\u8bf4\u660e<\/h2>\n<p>1\u3001<code>creatqrcode.php<\/code>\u662f\u751f\u6210\u5c0f\u7a0b\u5e8f\u7801\u7684\u754c\u9762\uff0c\u5176\u4e2d41\u884c\u548c42\u884c\u7684$appid\u548c$appsecret\u8981\u6362\u6210\u4f60\u7684\u5c0f\u7a0b\u5e8f\u7684\u3002\u4ee5\u53ca92\u884c\u7684env_version\u5728\u4f60\u7684\u5c0f\u7a0b\u5e8f\u4e0a\u7ebf\u540e\u8981\u6539\u4e3a<code>release<\/code>\uff0c\u5982\u679c\u662f\u5f00\u53d1\u8c03\u8bd5\u4e2d\uff0c\u5c31\u4fdd\u6301\u73b0\u72b6\u3002<br \/>2\u3001<code>login.php<\/code>\u662f\u5c0f\u7a0b\u5e8f\u7aef\u5411\u540e\u7aef\u8bf7\u6c42\u63a5\u53e3\u83b7\u53d6openid\u7684\uff0c\u5176\u4e2d11\u884c\u548c12\u884c\u7684$appid\u548c$appsecret\u8981\u6362\u6210\u4f60\u7684\u5c0f\u7a0b\u5e8f\u7684\u3002<br \/>3\u3001<code>scanCode.php<\/code>\u662f\u626b\u7801\u540e\u544a\u8bc9\u670d\u52a1\u5668\u4f60\u5df2\u7ecf\u5b8c\u6210\u626b\u7801\u7684\u540e\u7aef\u3002<br \/>4\u3001<code>getstatus.php<\/code>\u662f\u8f6e\u8be2\u626b\u7801\u72b6\u6001\u7684\u540e\u7aef\u3002<br \/>5\u3001<code>Db.php<\/code>\u662f\u6570\u636e\u5e93\u914d\u7f6e\u6587\u4ef6\uff0c\u9700\u8981\u8fdb\u53bb\u914d\u7f6e\u4f60\u7684\u6570\u636e\u5e93\u5730\u5740\u3001\u8d26\u53f7\u3001\u5bc6\u7801\u3001\u6570\u636e\u5e93\u540d\u79f0\u3002<\/p>\n<h2>\u6570\u636e\u5e93\u521b\u5efa<\/h2>\n<p>\u5c06\u8fd9\u6761SQL\u7c98\u8d34\u81f3\u4f60\u7684\u6570\u636e\u5e93\u7ba1\u7406\u7aef\u8fdb\u884c\u521b\u5efa\u6570\u636e\u5e93\u8868\u3002<\/p>\n<pre><code>CREATE TABLE `xcxqrcodelogin` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `scene` varchar(32) DEFAULT '',\n  `openid` varchar(32) DEFAULT '',\n  `status` varchar(2) DEFAULT '1' COMMENT '1\u672a\u626b\u78012\u5df2\u626b\u78013\u5df2\u767b\u5f55',\n  `creat_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,\n  PRIMARY KEY (`id`)\n) ENGINE=InnoDB AUTO_INCREMENT=148 DEFAULT CHARSET=utf8mb4<\/code><\/pre>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc1yYt\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h2>Demo<\/h2>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc1yYu\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc1yYv\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc1yYw\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVc1yYx\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h2>\u5c0f\u7a0b\u5e8f\u7aef\u4ee3\u7801<\/h2>\n<p>\u4ee5\u4e0a\u4ec5\u4e3a\u524d\u7aef\u548c\u540e\u7aef\u7684\u4ee3\u7801\uff0c\u5c0f\u7a0b\u5e8f\u7aef\u7684\u4ee3\u7801\u8bf7\u70b9\u51fb\u8fd9\u91cc\u4e0b\u8f7d\u3002<br \/>\u5c0f\u7a0b\u5e8f\u7aef\u4ee3\u7801\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=826SRP88CIyuThIBvWN6pg%3D%3D.tS0h441zktS40GhPfgdl3E0jox%2BMYGbbq%2FUJhAz8iRaZigtWRroju8MX1m6PI15z\" rel=\"nofollow\">https:\/\/likeyun.lanzout.com\/i&#8230;<\/a><\/p>\n<h2>\u4f5c\u8005<\/h2>\n<p>TANKING<br \/>\u5982\u9700\u8bf7\u6559\uff0c\u53ef\u52a0WeChat:sansure2016<\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000042279451\">https:\/\/segmentfault.com\/a\/1190000042279451<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9700\u6c42 \u7f51\u7ad9\u5982\u679c\u60f3\u8981\u5b9e\u73b0\u5fae\u4fe1\u626b\u7801\u767b\u5f55\u5176\u5b9e\u6709\u5f88\u591a\u79cd\u65b9\u6848\uff0c\u5e38\u89c1\u7684\u65b9\u6848\u5c31\u662f\u5fae\u4fe1\u5f00\u653e\u5e73\u53f0\u548c\u5fae\u4fe1\u516c\u4f17\u53f7\u670d\u52a1\u53f7\u3002\u524d\u8005\u662f\u76ee\u524d\u5927 [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[],"tags":[],"class_list":["post-10006122","post","type-post","status-publish","format-standard","hentry"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10006122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10006122"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10006122\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10006122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10006122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10006122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}