ホームページ  >  記事  >  バックエンド開発  >  WeChatバックグラウンド操作の基本管理

WeChatバックグラウンド操作の基本管理

WBOY
WBOYオリジナル
2016-08-08 09:26:181154ブラウズ

/**
* 作成者: PhpStorm.
* ユーザー: wym
* 日付: 15-3-18
* 時刻: 下午 2:15
*/

class Wx_function{
var $FromUsername = null;
var $ToUsername = null;
var $MsgType = null;
var $Event = null;
var $PicUrl = null;
var $EventKey = null;
var $Keyword = null;
var $obj = null;

function __construct(){
//系构造赋值
$postObj = simplexml_load_string($GLOBALS["HTTP_RAW_POST_DATA"], 'SimpleXMLElement', LIBXML_NOCDATA);
$this->gt;obj = $postObj;
$this-> FromUsername = $postObj->FromUserName;
$this->ToUsername = $postObj->ToUserName;
$this->EventKey = $postObj->EventKey; //
$this->MsgType = $postObj->MsgType;
$this->PicUrl = $postObj->PicUrl;
$this->Event = $postObj->Event;
$this ->キーワード = トリム($postObj->コンテンツ);
}


public function wxRequest($arr, $response){
//異種直接封装
$mssage = '';
switch ($response) {
case 'text' :
$this-& gt;wxGetText ($arr);
break;
case 'news' :
$mssage = $this->wxGetNews($arr);
break;
case 'voice':
年齢 = $this->getVoice($ arr);
}
//print_r($arr);
return $mssage;
}

// イベント处処理
public function wxEventRequest($Content, $response = 'text'){
$mssage = '';
switch ($this->MsgType) {
case 'event':
switch ( $this ->Event) {
case 'subscribe' :
switch ($response) {
case 'text' :
$mssage = ;wxGetText($Content);
break;
ケース 'ニュース' :
$mssage = $this->wxGetNews($Content);
break;
break;
case 'unsubscribe' :
break;
}
break;
}
return $mssage;
}

}

详细源コードの联系我

以上は、側面の内容を含む、マイクロ信後台のオペレーティング ベースの管理について説明しました。PHP の教義に関心のある友人の助けになることを望みます。

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
前の記事:nginxが起動する次の記事:nginxが起動する