茶果Aimerlavie3693805
2019-01-19 11:25
<?php //微信验证代码
//echo 'hello weixin imooc';
//将timestamp,nonce,token按字典序排序
$timestamp =$_GET['timestamp'];
$nonce =$_GET['nonce'];
$token ='123456';
$singnature=$_GET['singnature'];
$array =array($timestamp,$nonce,$token);
sort($array);
//将排序后的三个参数拼接后用sha1加密
$tmpstr=implode('',$array);//join
$tmpstr=sha1($tmpstr);
//将加密后的字符串与signature进行对比,判断该请求是否来自微信
if($tmpstr== $signature){
echo $_GET['echostr'];
exit;
}
$singnature=$_GET['signature'];
第6行sign
PHP实现微信公众平台开发—基础篇
102023 学习 · 156 问题
相似问题