晓夏

北漂的女孩

Good Luck To You!

PHP实现微信公众平台开发----代码验证

浏览量:445

<?php
//微信开发者验证验证的代码
//1.timestamp   ,nonce,token 按照字典顺序排序
$timestamp = $_GET['timestamp'];
$nonce  = $_GET['nonce'];
$token = 'ceshi'
$signature = $_GET['signature'];

$array = array($timestamp,$nonce,$token );
sort($array);
//2.将排序后的三个参数拼接后sha1加密
$timstr = implode('', $array);//join
$tmpstr = sha1($timstr);

//3.将加密后的字符串和signature进行对比
if($tmpstr == $signature ){
    echo $_GET['echostr'];
    exit;
}
?>


神回复

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。