<?php
/**
* wechat php test
*/
//define your token
define("TOKEN", "weixin");
$signature = $_GET['signature'];
$timestamp = $_GET['timestamp'];
$nonce = $_GET['nonce'];
$echostr = $_GET['echostr'];
$token = TOKEN;
$tmpArr = array($token, $timestamp, $nonce);
sort($tmpArr, SORT_STRING);
$tmpStr = implode( $tmpArr );
$tmpStr = sha1( $tmpStr );
if( $tmpStr == $signature ){
//没加这一句一直token验证失败
header('content-type:text');
echo $echostr;
}
?>
微信token验证代码
最新推荐文章于 2024-04-17 10:37:32 发布