public function action_index() { $token = 'wxtest'; $appid = 'wxc5b1d86df49a2dc4'; $encodingAesKey = ''; $wechat = new MyWechat($token, $encodingAesKey, $appid); $wechat->run(); }
public function action_index() { $wx_config = Kohana::config('weixin.default'); $token = $wx_config['token']; $appid = $wx_config['appid']; $encodingAesKey = $wx_config['encodingAesKey']; $wechat = new MyWechat($token, $encodingAesKey, $appid); $wechat->run(); }
/** * 收到语音消息时触发,回复语音识别结果(需要开通语音识别功能) * * @return void */ protected function onVoice() { $this->responseText('收到了语音消息,识别结果为:' . $this->getRequest('Recognition')); } /** * 收到自定义菜单消息时触发,回复菜单的EventKey * * @return void */ protected function onClick() { $this->responseText('你点击了菜单:' . $this->getRequest('EventKey')); } /** * 收到未知类型消息时触发,回复收到的消息类型 * * @return void */ protected function onUnknown() { $this->responseText('收到了未知类型消息:' . $this->getRequest('msgtype')); } } $wechat = new MyWechat('weixin', TRUE); $wechat->run();