public function responseMsg()
{
//get post data, May be due to the different environments
$postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
//extract post data
if (!empty($postStr)) {
$postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);//发送人
$fromUsername = $postObj->FromUserName;//接收人
$toUsername = $postObj->ToUserName;
$keyword = trim($postObj->Content);
$msgType = $postObj->MsgType;
if($msgType == 'text') {//接收类型为文本
echo sprintf(wechatCallbackapi::$textTpl, $fromUsername, $toUsername, time(), "text", "返回文本");//echo sprintf(wechatCallbackapi::$imageTpl, $fromUsername, $toUsername, time(), "返回文本", $event["t"], "图片地址", "图片链接地址");
} else if($msgTy
微信公众平台自定义脚本
最新推荐文章于 2023-04-21 17:22:43 发布