Today to get the service number of the message reply to the custom PHP, found that the company's service number does not work properly, but with their own public number can automatically reply to the message
What would be the cause of this situation, please?
Valid ();} else{$wechatObj->responsemsg ();} Class wechatcallbackapitest{Public Function valid () {$echoStr = $_get["Echostr"]; if ($this->checksignature ()) {header (' content-type:text '); Echo $echoStr; Exit }} Private Function Checksignature () {$signature = $_get["signature"]; $timestamp = $_get["timestamp"]; $nonce = $_get["nonce"]; $token = token; $TMPARR = Array ($token, $timestamp, $nonce); Sort ($TMPARR, sort_string); $TMPSTR = implode ($TMPARR); $TMPSTR = SHA1 ($TMPSTR); if ($tmpStr = = $signature) {return true; }else{return false; }} Public Function responsemsg () {$postStr = $GLOBALS ["Http_raw_post_data"]; if (!empty ($POSTSTR)) {$POSTOBJ = simplexml_load_string ($postStr, ' simplexmlelement ', libxml_nocdata); $fromUsername = $POSTOBJ->fromusername; $toUsername = $POSTOBJ->tousername; $keyword = Trim ($postObj->content); $time = time (); $TEXTTPL = "
%s 0
%s
%s
%s
%s
"; $msgType = "text"; $CONTENTSTR = Date ("Y-m-d h:i:s", Time ()). " \ n '. ' Hello '; $RESULTSTR = sprintf ($TEXTTPL, $fromUsername, $toUsername, $time, $msgType, $CONTENTSTR); Echo $resultStr; }else{echo ""; Exit }}}?>
Reply content:
Today to get the service number of the message reply to the custom PHP, found that the company's service number does not work properly, but with their own public number can automatically reply to the message
What would be the cause of this situation, please?
Valid ();} else{$wechatObj->responsemsg ();} Class wechatcallbackapitest{Public Function valid () {$echoStr = $_get["Echostr"]; if ($this->checksignature ()) {header (' content-type:text '); Echo $echoStr; Exit }} Private Function Checksignature () {$signature = $_get["signature"]; $timestamp = $_get["timestamp"]; $nonce = $_get["nonce"]; $token = token; $TMPARR = Array ($token, $timestamp, $nonce); Sort ($TMPARR, sort_string); $TMPSTR = implode ($TMPARR); $TMPSTR = SHA1 ($TMPSTR); if ($tmpStr = = $signature) {return true; }else{return false; }} Public Function responsemsg () {$postStr = $GLOBALS ["Http_raw_post_data"]; if (!empty ($POSTSTR)) {$POSTOBJ = simplexml_load_string ($postStr, ' simplexmlelement ', libxml_nocdata); $fromUsername = $POSTOBJ->fromusername; $toUsername = $POSTOBJ->tousername; $keyword = Trim ($postObj->content); $time = time (); $TEXTTPL = "
%s 0
%s
%s
%s
%s
"; $msgType = "text"; $CONTENTSTR = Date ("Y-m-d h:i:s", Time ()). " \ n '. ' Hello '; $RESULTSTR = sprintf ($TEXTTPL, $fromUsername, $toUsername, $time, $msgType, $CONTENTSTR); Echo $resultStr; }else{echo ""; Exit }}}?>
You can first look at whether your public number configuration information is configured in the code as a company's information
Resolved, is two public number in the binding URL when the choice of mode is not the same, select ' Safe mode ' will error, select ' Civilized mode ' can be accessed normally.