コード例 #1
0
 public function __toString()
 {
     $responseObj = null;
     $responseObj = new TextResponse($this->fromUserName, $this->toUserName, $this->msg);
     global $log;
     $log->record($responseObj->__toString());
     return $responseObj->__toString();
 }
コード例 #2
0
ファイル: wechat.php プロジェクト: Winsen1990/easyilife
        break;
    default:
        echo htmlspecialchars($_GET['echostr']);
        exit;
}
$response_id = intval($response_id);
//根据response_id进行响应
if (0 < $response_id) {
    $get_response = 'select `msgType`,`content`,`title`,`description`,`musicUrl`,`HQMusicUrl`,`url`,`picUrl`,`mediaId`,`thumbMediaId` from ';
    $get_response .= $db->table('wx_response') . ' where `id`=' . $response_id;
    $response_rule = $db->fetchRow($get_response);
    switch ($response_rule['msgType']) {
        case 'text':
            //文本信息回复
            $responseObj = new TextResponse($public_account, $openid, $response_rule['content']);
            $response = $responseObj->__toString();
            break;
        case 'news':
            //图文信息回复
            $title = unserialize($response_rule['title']);
            $description = unserialize($response_rule['description']);
            $picUrl = unserialize($response_rule['picUrl']);
            $url = unserialize($response_rule['url']);
            $items = array();
            foreach ($title as $key => $value) {
                $items[] = array('title' => $value, 'description' => $description[$key], 'picUrl' => $picUrl[$key], 'url' => $url[$key]);
            }
            $responseObj = new NewsResponse($public_account, $openid, $items);
            $response = $responseObj->__toString();
            break;
        case 'themes':
コード例 #3
0
 public function __toString()
 {
     $responseObj = null;
     $responseObj = new TextResponse($this->fromUserName, $this->toUserName, $this->msg);
     return $responseObj->__toString();
 }