第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

為什么關(guān)注不能自動(dòng)回復(fù)

為什么關(guān)注沒有自動(dòng)回復(fù),求大神們指教,代碼是找著老師打的。

<?php

header("Content-type: text/html; charset=utf-8");?

// 本類由系統(tǒng)自動(dòng)生成,僅供測(cè)試用途

class IndexAction extends Action?

{

? ? public function index()

? ? {

//$this->show('<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} body{ background: #fff; font-family: "微軟雅黑"; color: #333;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.8em; font-size: 36px }</style><div style="padding: 24px 48px;"> <h1>:)</h1><p>歡迎使用 <b>ThinkPHP</b>!</p></div><script type="text/javascript" src="http://tajs.qq.com/stats?sId=9347272" charset="UTF-8"></script>','utf-8');

//獲得參數(shù) signature nonce token timestamp echostr

$nonce ? ? = $_GET['nonce'];

$token ? ? = "weixin";

$timestamp = $_GET['timestamp'];

$echostr ? = $_GET['echostr'];

$signature = $_GET['signature'];

//形成數(shù)組,然后按字典序排序

$array = array($nonce, $timestamp, $token);

sort($array);

//拼接成字符串,sha1加密 ,然后與signature進(jìn)行校驗(yàn)

$str = sha1( implode( '',$array ) );

if( $str ?== $signature && $echostr ){

//第一次接入weixin api接口的時(shí)候

echo ?$echostr;

exit;

}else

{

$this->responseMsg();

}

public function responseMsg()

{

//1.獲取到微信推送過來post數(shù)據(jù)(xml格式)

$postArr = $GLOBALS['HTTP_RAW_POST_DATA'];

//2.處理消息類型,并設(shè)置回復(fù)類型和內(nèi)容

/*<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>

<FromUserName><![CDATA[FromUser]]></FromUserName>

<CreateTime>123456789</CreateTime>

<MsgType><![CDATA[event]]></MsgType>

<Event><![CDATA[subscribe]]></Event>

</xml>*/

$postObj = simplexml_load_string( $postArr );

//$postObj->ToUserName = '';

//$postObj->FromUserName = '';

//$postObj->CreateTime = '';

//$postObj->MsgType = '';

//$postObj->Event = '';

// gh_e79a177814ed

//判斷該數(shù)據(jù)包是否是訂閱的事件推送

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

//如果是關(guān)注 subscribe 事件

if( strtolower($postObj->Event )== 'subscribe' ){

//回復(fù)用戶消息(純文本格式)

$toUser ? = $postObj->FromUserName;

$fromUser = $postObj->ToUserName;

$time ? ? = time();

$msgType ?= ?'text';

$content ?= '歡迎關(guān)注我們的微信公眾賬號(hào)'.$postObj->FromUserName.'-'.$postObj->ToUserName;

$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, $toUser, $fromUser, $time, $msgType, $content);

echo $info;

}

? ? }

}

}

}


正在回答

2 回答

$postArr = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : file_get_contents("php://input"); ?//最佳解決方式,適用tp所有版本

0 回復(fù) 有任何疑惑可以回復(fù)我~

你要把你的代碼貼出來,才能看哪里出問題了!

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

qq_倞晨渼景_03988080 提問者

嗯嗯 代碼貼出來了 麻煩幫我看看 謝謝
2017-04-21 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

為什么關(guān)注不能自動(dòng)回復(fù)

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)