? WeChat ?? ??? ?? ??????? ?? ??? ???? ?? ?? ??? ???? ???? ??? ?????.
? ??? ?? ? ???? ?????.
?? ?? ??? ???? ??
?? ?? ??? ??? ??
?? ??
1. ?? ?? ??? ???? ??
?? WeChat ????, ?? ??? ?? ??? ???? ???? ? ????. ???? ???? ?? ??? ???? ????? ???? ?? ?? ???? ?? ???? ?? ? MsgType? transfer_customer_service? ???? ???? ???. WeChat ??? ? ???? ??? ???? ?? ???? ?????. ?? ??? ?? ?? ?? ?? ?? ???? ?? ??? ????? ?????.
??? ???? ?? ??? ????
<xml> ????<ToUserName><![CDATA[touser]]></ToUserName> ????<FromUserName><![CDATA[fromuser]]></FromUserName> ????<CreateTime>1399197672</CreateTime> ????<MsgType><![CDATA[transfer_customer_service]]></MsgType> </xml>
? ???? ??? ??? ????
//回復多客服消息 ????private?function?transmitService($object) ????{ ????????$xmlTpl?=?"<xml> <ToUserName><![CDATA[%s]]></ToUserName> <FromUserName><![CDATA[%s]]></FromUserName> <CreateTime>%s</CreateTime> <MsgType><![CDATA[transfer_customer_service]]></MsgType> </xml>"; ????????$result?=?sprintf($xmlTpl,?$object->FromUserName,?$object->ToUserName,?time()); ????????return?$result; ????}
2.
???? ?? ???? ????? ???? ?? ? "?????", "????" ?? ??? ?? ??? ????.
? ??? ??? ???? ?????. ???? ?? ?? ???? ??? ??? ??? ???? ??? ?? ?? ??? ???? ????? ?????(???? WeChat?? ?? ??? ?? ? ???, WeChat ?? ??? ??? ??? ???? ?? ???? ?? ???? ?????.
?? ??? ??? ????.
//接收文本消息 ????private?function?receiveText($object) ????{ ????????$keyword?=?trim($object->Content); ????????if?(strstr($keyword,?"投訴")?||?strstr($keyword,?"你好")?||?strstr($keyword,?"在嗎")){ ????????????$result?=?$this->transmitService($object); ????????} ????????return?$result; ????}
3. ?? ??
responseMsg(); }else{ ????$wechatObj->valid(); } class?wechatCallbackapiTest { ????//驗證消息 ????public?function?valid() ????{ ????????$echoStr?=?$_GET["echostr"]; ????????if($this->checkSignature()){ ????????????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)){ ????????????$this->logger("R?".$postStr); ????????????$postObj?=?simplexml_load_string($postStr,?'SimpleXMLElement',?LIBXML_NOCDATA); ????????????$RX_TYPE?=?trim($postObj->MsgType); ????????????switch?($RX_TYPE) ????????????{ ????????????????case?"event": ????????????????????$result?=?$this->receiveEvent($postObj); ????????????????????break; ????????????????case?"text": ????????????????????$result?=?$this->receiveText($postObj); ????????????????????break; ????????????} ????????????$this->logger("T?".$result); ????????????echo?$result; ????????}else?{ ????????????echo?""; ????????????exit; ????????} ????} ????//接收事件消息 ????private?function?receiveEvent($object) ????{ ????????switch?($object->Event) ????????{ ????????????case?"subscribe": ????????????????$content[]?=?array("Title"?=>"歡迎關注方倍工作室",?"Description"?=>"使用方法:\n1.發(fā)送快遞單號,例如6367532560,可查詢快遞詳情",?"PicUrl"?=>"http://www.3856.cc/weixin/weixin/logo.jpg",?"Url"?=>""); ????????????????break; ????????????default: ????????????????$content?=?"receive?a?new?event:?".$object->Event; ????????????????break; ????????} ???????? ????????if(is_array($content)){ ????????????if?(isset($content[0])){ ????????????????$result?=?$this->transmitNews($object,?$content); ????????????}else?if?(isset($content['MusicUrl'])){ ????????????????$result?=?$this->transmitMusic($object,?$content); ????????????} ????????}else{ ????????????$result?=?$this->transmitText($object,?$content); ????????} ????????return?$result; ????} ????//接收文本消息 ????private?function?receiveText($object) ????{ ????????$keyword?=?trim($object->Content); ????????if($keyword?==?"時間"?||?$keyword?==?"測試"){ ????????????$content?=?date("Y-m-d?H:i:s",time()); ????????????$result?=?$this->transmitText($object,?$content); ????????} ????????//觸發(fā)多客服模式 ????????else?if?(strstr($keyword,?"您好")?||?strstr($keyword,?"你好")?||?strstr($keyword,?"在嗎")?||?strstr($keyword,?"有人嗎")){ ????????????$result?=?$this->transmitService($object); ????????????return?$result; ????????} ????????return?$result; ????} ????private?function?transmitText($object,?$content) ????{ ????????$textTpl?=?""; ????????$result?=?sprintf($textTpl,?$object->FromUserName,?$object->ToUserName,?time(),?$content); ????????return?$result; ????} ????private?function?transmitNews($object,?$newsArray) ????{ ????????if(!is_array($newsArray)){ ????????????return; ????????} ????????$itemTpl?=?"???? %s - ????????
"; ????????$item_str?=?""; ????????foreach?($newsArray?as?$item){ ????????????$item_str?.=?sprintf($itemTpl,?$item['Title'],?$item['Description'],?$item['PicUrl'],?$item['Url']); ????????} ????????$newsTpl?=?"???????? ???????? ???????? ???? "; ????????$result?=?sprintf($newsTpl,?$object->FromUserName,?$object->ToUserName,?time(),?count($newsArray)); ????????return?$result; ????} ????private?function?transmitMusic($object,?$musicArray) ????{ ????????$itemTpl?=?" %s %s $item_str ???? "; ????????$item_str?=?sprintf($itemTpl,?$musicArray['Title'],?$musicArray['Description'],?$musicArray['MusicUrl'],?$musicArray['HQMusicUrl']); ????????$textTpl?=?"???? ???? ???? "; ????????$result?=?sprintf($textTpl,?$object->FromUserName,?$object->ToUserName,?time()); ????????return?$result; ????} ???? ????//回復多客服消息 ????private?function?transmitService($object) ????{ ????????$xmlTpl?=?"<xml> <ToUserName><![CDATA[%s]]></ToUserName> <FromUserName><![CDATA[%s]]></FromUserName> <CreateTime>%s</CreateTime> <MsgType><![CDATA[transfer_customer_service]]></MsgType> </xml>"; ????????$result?=?sprintf($xmlTpl,?$object->FromUserName,?$object->ToUserName,?time()); ????????return?$result; ????} ???? ????private?function?logger($log_content) ????{ ????????if(isset($_SERVER['HTTP_APPNAME'])){???//SAE ????????????sae_set_display_errors(false); ????????????sae_debug($log_content); ????????????sae_set_display_errors(true); ????????}else?if($_SERVER['REMOTE_ADDR']?!=?"127.0.0.1"){?//LOCAL ????????????$max_size?=?10000; ????????????$log_filename?=?"log.xml"; ????????????if(file_exists($log_filename)?and?(abs(filesize($log_filename))?>?$max_size)){unlink($log_filename);} ????????????file_put_contents($log_filename,?date('H:i:s')."?".$log_content."\r\n",?FILE_APPEND); ????????} ????} } ?> %s $item_str
4. ?? ????
1. ?? ?? ?? ??? ???? ?? ???? ?? ?? ??? ??? ??? ? ????.
2. ?? ?? ?? ??? ???? ??? ??? ??? ?? ???? ?? ?? ?? ?? ??? ???? ???? ?? ?? ??? ?? ??? ??????! ! !
? ??? WeChat ?? ???? ??? ?? ???? ?????? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

PHP? ? ?? ? ?? ? ?????, ?? WeChat ??? ?? ???? ?? ?? ???? ?????. ??? ?? ? ?? ??? ???? WeChat ??? PHP? ???? ???? ????. PHP? ??? ?? ???? ?? ?? ???? ?????. WeChat ???? ??? ??? ? ???? ??? ??? ???? ?? ??? ?? ??? ?????. ??? ? ??? ??? ?? ???? ?? ??? ?? ???? ??? ? ?? ????? ??? ? ? ????.

WeChat ?? ??? ??? ? ?? ??? ?? ?????. ?? ??? ????? ?? ??? ??? ??? ? ?? ?? ????, ??? ?? ? ?? ??? ?? ??? ????? ???. ? ????? PHP? ???? WeChat ?? ??? ???? ??? ?????. WeChat ?? ?? ??? ???? ?? WeChat ?? ?? ??? ??? ???. WeChat ?? ?????? WeChat ?? ??, ?? ?? ? ?? ??? ???? ??? API ??? ???? ???. PHP ??? ???? ???? ???? WeChat?? ????? ???? PH? ???? ???.

WeChat? ??? ?? ?? ? ?? ??? WeChat? ??? ??? ???? ??????. WeChat ?? ??? ??? ??? WeChat ???? ???? ??? ?? ? ?????. ??? ?? ???? ????? ??? ?????? ?? ??? ?? ??? ?? ?????. ??? WeChat ?? ??? ??? ???? ?? ?? ?????. ? ????? PHP? ???? WeChat ?? ??? ??? ???? ??? ?????. 1. ?? ?? WeChat ?? ??? ??? ????? ?? ?? ??? ???? ???. PHP WeChat ?? ??? ??? ?? ?? ?? ?? ??: Sub

WeChat? ?? ???? ?? ? ??? ??? ??? ?? ??? ? ?????. ??? ???? ??? ?? ?? ? ?? ???? WeChat ???? ???? ??? ??????. WeChat ???? ??? ? ?? ???? ??? ?????. ?? ??? ?? ?? ? ? ???? ?? WeChat ??? PHP ??? ??? ? ????. 1. PHP ?? WeChat ?? PHP? ? ?? ???? ?? ???? ?? ?? ?? ? ???? ?????. WeChat ?? ????? ???? ?? ?????? ???? PHP ??? ???? WeChat? ??? ? ????.

WeChat ?? ?? ???? ??? ?? ??? ???? ???? ? ? ???? ??? ? ??? ?? ?? ??? ?????. ? ????? PHP? ???? WeChat ??? ?? ?? ??? ???? ??? ?????. 1. WeChat ???? openid? ?????. WeChat ??? ?? ?? ??? ???? ?? ?? ???? openid? ???? ???. WeChat ?? ??? ??? ? ??? ??? ?? openid? ?? ?? ???? ?????. ??? ??? ???? ?? ??? ?? ???? ?? ? ????.

WeChat? ???? ??? ?? ? ??? ?????? ??? ???, WeChat? ??? ??? ??? ?? ??? ??? ??? ??? ?? ????. ??? ?? WeChat? ??? ????? ???? ?? ??? ??? ???? WeChat ??? ???? ?? ?? ???? ????. ? ? ?? ?? ??? ?? ?? ?????. ???? PHP ??????? ?? ??? ?? ??? ??? ???? ???? ??? ??? ?????. 1. WeChat ?? ??? ??? ?? ??? ?????. ?? ??? ?? ??? ???? ??? ?????.

PHP? ???? WeChat ?? ??? ???? ?? WeChat ?? ??? ?? ??? ?? ? ?? ??? ?? ??? ??? ????, ????? ???? ? ??? PHP? ???? WeChat ?? ??? ??? ?? ????. ? ????? PHP? ???? WeChat ?? ??? ???? ???? ??? ?????. 1??: WeChat ?? ??? ??? ??? ????. WeChat ?? ?? ??? ???? ?? WeChat ?? ??? ??? ??? ???? ???. ???? ?? ??? WeChat ?? ??? ?? ????? ?????.

???? ??? ??? ??? ???? WeChat? ?? ? ??? ???? ???? ?? ??? ?????. ?? ? ?????? ??? WeChat ??? PHP? ???? ??? ?? ???? ??? ?????. ? ????? ?? WeChat ??? PHP? ???? ??? ?? ?? ?? ???? ?? ? ? ?? ??? ?????. 1. ?? ?? ?? WeChat? ???? ?? ?? ?? ?? ??? ???? ???. ??, PHP ?? ??? WeChat ?? ???? ???? ???.
