class Wechat
{
public function __construct(){
$this->checkSignature();
}
private function checkSignature()
{
$signature = $_GET["signature"]; // 加密签名 微信服务器
$timestamp = $_GET["timestamp"]; // 时间戳
$nonce = $_GET["nonce"]; // 随机数
$echostr = $_GET['echostr'];
$token = 'zhangxuhui';
$tmpArr = array($token, $timestamp, $nonce);
sort($tmpArr, SORT_STRING);
$tmpStr = implode( $tmpArr );
$tmpStr = sha1( $tmpStr );
if( $tmpStr == $signature ){
echo $echostr;
}else{
return false;
}
}
public function index(){
}
}
版权属于:
公子初心
作品采用:
《
署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)
》许可协议授权
评论 (0)