public function index(){
$echoStr =
$_GET[
"echostr"];
if(!
$echoStr) {
echo $this -> responseMsg();
}
else {
if(
$this -> checkSignature()) {
echo $echoStr;
exit;
}
}
}
public function checkSignature(){
$echoStr =
$_GET[
"echostr"];
$signature =
$_GET[
"signature"];
$timestamp =
$_GET[
"timestamp"];
$nonce =
$_GET[
"nonce"];
$token =
$this -> token;
$tmpArr =
array(
$token,
$timestamp,
$nonce);
sort(
$tmpArr, SORT_STRING);
$tmpStr = sha1(implode(
$tmpArr));
if (
$tmpStr ==
$signature) {
return true;
}
else {
return false;
}
}
写好这两个方法以后把微信公众号里的基本配置地址改成你的地址即可。记住http的域名就写http,https的就写https,如果https写成了http,就会导致接入失败
转载请注明原文地址: https://www.6miu.com/read-2620526.html