public function __toString() { $responseObj = null; $responseObj = new TextResponse($this->fromUserName, $this->toUserName, $this->msg); global $log; $log->record($responseObj->__toString()); return $responseObj->__toString(); }
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':
public function __toString() { $responseObj = null; $responseObj = new TextResponse($this->fromUserName, $this->toUserName, $this->msg); return $responseObj->__toString(); }