-
微信簽名驗證查看全部
-
xml格式根據微信公眾號的格式來給的,接受數據的信息從獲取參數,$post查看全部
-
基于tp(thinkphp)框架查看全部
-
不錯不錯查看全部
-
curl查看全部
-
access_token查看全部
-
消息回復普通查看全部
-
事件推送查看全部
-
課程詳情查看全部
-
public function responemsg(){ //這個東西就可以把微信發來的消息給接收了,是一個XML $postArr = $GLOBALS['HTTP_RAW_POST_DATA']; file_put_contents('a.xml', $postArr); //接受了就開始處理了,這個函數把xml轉換為一個對象 $postObj = simplexml_load_string($postArr); //$postObj->ToUserName 公眾號 // $postObj->FromUserName openid //$postObj->CreatTime 創建時間 // $postObj->MsgType 消息類型 //$postObj->Event if(strtolower($postObj->MsgType)=='event'){ if(strtolower($postObj->Event=='subscribe')){ $touser = $postObj->FromUserName; $fromuser= $postObj->ToUserName; $time = time(); $content= '歡迎關注'; $MsgType = 'text'; $temp = "<xml> <ToUserName><![CDATA[%s]]></ToUserName> <FromUserName><![CDATA[%s]]></FromUserName> <CreateTime>%s</CreateTime> <MsgType><![CDATA[%s]]></MsgType> <Content><![CDATA[%s]]></Content> </xml>"; $temp = trim($temp); $temp = sprintf($temp,$touser,$fromuser,$time,$MsgType,$content); echo $temp;查看全部
-
public function index(){ $nonce = $_GET['nonce']; $token = 'weixin'; $timestamp = $_GET['timestamp']; $echostr = $_GET['echostr']; $signature = $_GET['signature']; $array = array($nonce,$timestamp,$token); sort($array); $str = sha1(implode($array)); if($str == $signature && $echostr){ echo $echostr; exit; }else{ $this ->responemsg(); } }查看全部
-
獲取微信推送過來POST數據(XML格式) $GLOBALS("HTTP_RAW_POST_DATA");查看全部
-
很實用的教程。不知道未認證的公眾號是否都可以用這些功能。查看全部
-
獲取微信ACCESS_TOKEN查看全部
-
123123查看全部
舉報
0/150
提交
取消