case 'text': $template = "<xml> <ToUserName><![CDATA[%s]]></ToUserName> <FromUserName><![CDATA[%s]]></FromUserName> <CreateTime>%s</CreateTime> <MsgType><![CDATA[%s]]></MsgType> <Content><![CDATA[%s]]></Content> </xml>"; $info = sprintf($template, $array['FromUserName'], $array['ToUserName'], time(), "text", $submenuData['content']);// echo $resultStr; echo $info; break; case 'image': $image = "<Image> <MediaId><![CDATA[%s]]></MediaId> </Image>"; $item_str = sprintf($image, $submenuData['media_id']); $xml = "<xml> <ToUserName><![CDATA[%s]]></ToUserName> <FromUserName><![CDATA[%s]]></FromUserName> <CreateTime>%s</CreateTime> <MsgType><![CDATA[image]]></MsgType> $item_str </xml>"; $result = sprintf($xml, $array['FromUserName'], $array['ToUserName'], time()); echo $result; break; case 'news': $management = model('management')->where(['id' => $submenuData['content']])->find(); $itemTpl = "<item> <Title><![CDATA[%s]]></Title> <Description><![CDATA[%s]]></Description> <PicUrl><![CDATA[%s]]></PicUrl> <Url><![CDATA[%s]]></Url> </item> "; $item_str = ""; $url = "https://chat.wenidc.com/notify/wechat/picture/id".$submenuData['content']; $item_str = sprintf($itemTpl, $management['title'], $management['digest'], $management['picurl'], $url); $newsTpl = "<xml> <ToUserName><![CDATA[%s]]></ToUserName> <FromUserName><![CDATA[%s]]></FromUserName> <CreateTime>%s</CreateTime> <MsgType><![CDATA[news]]></MsgType> <Content><![CDATA[]]></Content> <ArticleCount>%s</ArticleCount> <Articles> $item_str</Articles> </xml>"; $result = sprintf($newsTpl, $array['FromUserName'], $array['ToUserName'], time(), 1); echo $result; break; default: # code... break;
在微信第三方平台指定的推送方法里回接收到对应的值做出对应的判断回复
微信公众号被动回复
最新推荐文章于 2022-10-02 14:39:54 发布