接入微信公众账号API--验证的代码实现
发布时间:2020-12-14 19:01:00 所属栏目:资源 来源:网络整理
导读:? php // 1、将timestamp,nonce,token 按字典序排序 $timestamp = $_GET ['timestamp' ]; $nonce = $_GET ['nonce' $token = 'weixin'; 你在公众平台上填写的token $signature = $_GET ['signature' $arr = array ( $timestamp , $nonce ,1)">$token ); sort
<?php //1、将timestamp,nonce,token 按字典序排序 $timestamp = $_GET['timestamp']; $nonce = $_GET['nonce'$token = 'weixin'; 你在公众平台上填写的token $signature = $_GET['signature'$arr = array( $timestamp,$nonce,1)">$token ); sort($arr); 2、将排序后的3个参数拼接后用sha1加密 $tmpstr = implode('',1)">); sha1($tmpstr3、将加密后的字符串与signature进行对比,判断该请求是否来自微信 if($tmpstr == $signature){ echo $_GET['echostr']; exit; } ? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |