《微信公众服务号index文件.doc》由会员分享,可在线阅读,更多相关《微信公众服务号index文件.doc(2页珍藏版)》请在三一办公上搜索。
1、valid();class wechatCallbackapiTest public function valid() $echoStr = $_GETechostr; /随机字符串 if($this-checkSignature() echo $echoStr; exit; private function checkSignature() $signature = $_GETsignature; /微信加密签名 $timestamp = $_GETtimestamp; /时间戳 $nonce = $_GETnonce; /随机数 $token = TOKEN; $tmpArr = arra
2、y($token, $timestamp, $nonce); sort($tmpArr); /进行字典序排序 /sha1加密后与签名对比 if( sha1(implode($tmpArr) = $signature ) return true; else return false; function traceHttp() logger(REMOTE_ADDR:.$_SERVERREMOTE_ADDR.(strpos($_SERVERREMOTE_ADDR, 101.226)? From WeiXin: Unknown IP); logger(QUERY_STRING:.$_SERVERQUERY_STRING);function logger($content) file_put_contents(log.html,date(Y-m-d H:i:s ).$content.,FILE_APPEND);?