配置微信服务器步骤:
利用阿里云申请的域名,登录ftp。编写index.php代码,如下:
<?php
/**
* wechat php test
*/
//define your token
define("TOKEN", "weixin");
$wechatObj = new wechatCallbackapiTest();
$wechatObj->valid();
class wechatCallbackapiTest
{
public function valid()
{
if(isset($_GET['echostr']) && $this->checkSignature()){
$echoStr = $_GET["echostr"];
echo $echoStr;
exit;
}else{
$this->responseMsg();
}
//valid signature , option
// if($this->checkSignature()){
// }
}
public function responseMsg()
{
//get post data, May be due to the different environments
// $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
$postStr = file_get_contents("php://input");
file_put_contents("msg.txt", $postStr,FILE_APPEND);
//extract post data
i