Background Operations Foundation Class management
/**
* Created by Phpstorm.
* USER:WYM
* date:15-3-18
* Time: 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 () {
System Construction Assignment
$POSTOBJ = simplexml_load_string ($GLOBALS ["Http_raw_post_data"], ' simplexmlelement ', libxml_nocdata);
$this->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->keyword = Trim ($postObj->content);
}
Public Function wxrequest ($arr, $response) {
//different type direct encapsulation
$mssage = ';
Switch ($response) {
case ' text ':
$mssage = $this->wxgettext ($arr);
Break
Case ' news ':
$mssage = $this->wxgetnews ($arr);
Break
Case ' Voice ':
$mssage = $this->getvoice ($arr);
}
//print_r ($arr);
return $mssage;
}
Event handling
Public Function Wxeventrequest ($Content, $response = ' text ') {
$mssage = ";
Switch ($this->msgtype) {
Case ' event ':
Switch ($this->event) {
Case ' subscribe ':
Switch ($response) {
Case ' text ':
$mssage = $this->wxgettext ($Content);
Break
Case ' News ':
$mssage = $this->wxgetnews ($Content);
Break
}
Break
Case ' unsubscribe ':
Break
}
Break
}
return $mssage;
}
}
Need detailed source of contact me