猿问

为什么我的单文本回复消息代码实现不了

if(strtolower($postObj->MsgType) == 'text'){

     if($postObj->Content == '你好'){

         $template = "<xml>

                                 <ToUserName><![CDATA[%s]]></ToUserName>

                                 <FromUserName><![CDATA[%s]]></FromUserName>

                                 <CreateTime>%s</CreateTime>

                                 <MsgType><![CDATA[%s]]></MsgType>

                                 <Content><![CDATA[%s]]></Content>

                                 </xml>"

         $fromUser = $postObj->ToUserName;

         $toUser = $postObj->FromUserName;

         $time = time();

         $content = "您好,感谢您的关注!";

         $msgType = 'text';

         $info = sprintf($template,$toUser,$fromUser,$time,$msgType,$content);

         echo $info;

     }

}


慕容5077611
浏览 1851回答 3
3回答

fdsgasgg

字符串模版没分号结尾?

慕容5077611

惭愧,犯了一个这么低级的错误,总感觉没有错没道理不成功可试了好多次都不成功
随时随地看视频慕课网APP
我要回答