先定义Token
define("TOKEN", "xxx");
实例化调用run方法
$wechatObj = new wechatCallbackapiTest();
$wechatObj->run();
public function run()
{
if($this->checkSignature()==false){
die('非法请求');
}
if(isset($_GET["echostr"])){
$echoStr = $_GET["echostr"];
echo $echoStr;
exit;
}else{
$this->responseMsg();
}
// $echoStr = $_GET["echostr"];
// //valid signature , option
// if($this->checkSignature()){
// // echo $echoStr;
// // exit;
// }
}
定义responseMsg方法
public function responseMsg()
{
//get post