我原来可以接入的php验证程序,这两天无法正确验证了,查了半天也没弄明白!
class wxImport{
/**
- 微信第三方服务器验证函数
- @return boolean 成功返回true */ private function checkSignature() { $signature = $_GET["signature"]; $timestamp = $_GET["timestamp"]; $nonce = $_GET["nonce"];
$token = WxConfig::MTOKEN; // $token='group1com1cn';
$tmpArr = array($token, $timestamp, $nonce);
sort($tmpArr, SORT_STRING);
$tmpStr = implode( $tmpArr );
$tmpStr = sha1( $tmpStr );
if( $tmpStr == $signature ){
return true;
}else{
return false;
}
}
/**
- 外部调用实现接入验证 */ public function valid(){
if($this->checkSignature()){ echo $_GET["echostr"]; exit; }
} }
http://bbs.csdn.net/topics/392089845