public function _initException(Dispatcher $dispatcher) { // $exception = new Exception(); // $dispatcher->setErrorHandler(array(get_class($this),'error_handler')); register_shutdown_function(function () { SystemLogger::close(); }); //Initialized the SystemLogger $systemLogDir = Yaf\Application::app()->getConfig()->get('log')->get('dir'); if ($systemLogDir) { SystemLogger::init($systemLogDir, Logger::LEVEL_DEBUG); } }
public function wechatAction() { SystemLogger::debug("GETS:" . implode(",", $_GET)); $options = array('token' => 'krxkid', 'encodingaeskey' => '2un8rwmEnk2icZnqoIR8niY2M2292zwJjxbEEyiUveL', 'appid' => 'wx9294ba1287a3f37e', 'appsecret' => 'ee5cdb887bc9b61625a0c59b75f6919b'); $weObj = new WeChatSDK($options); $weObj->valid(); $type = $weObj->getRev()->getRevType(); switch ($type) { case Wechat::MSGTYPE_TEXT: $weObj->text("hello, I'm wechat")->reply(); exit; break; case Wechat::MSGTYPE_EVENT: break; case Wechat::MSGTYPE_IMAGE: break; default: $weObj->text("help info")->reply(); } //获取菜单操作: $menu = $weObj->getMenu(); //设置菜单 $newmenu = array("button" => array(array('type' => 'click', 'name' => '最新消息', 'key' => 'MENU_KEY_NEWS'), array('type' => 'view', 'name' => '我要搜索', 'url' => 'http://www.baidu.com'))); $result = $weObj->createMenu($newmenu); return false; }
/** * [logsMessageAction ] * @param Request_Abstract $request [description] * @param Response_Abstract $response [description] * @return [type] [description] */ private function logsMessageAction(Request_Abstract $request, Response_Abstract $response) { $permission = Application::app()->getConfig()->get("log")->get("permission"); if ($permission and $permission == false) { return; } SystemLogger::info(' Controller: ' . $request->getControllerName() . ' Action:' . $request->getActionName() . ' is called'); }