public function _initService(Yaf\Dispatcher $dispatcher) { $service = Core\ServiceLocator::getInstance(); //db $service->set('db', function () { return new Core\Connection($this->config['db']); }); //log $service->set('log', function () { $logConfig = $this->config['log']; $log = new Monolog\Logger($logConfig['loger']); $log->pushHandler(new Monolog\Handler\StreamHandler($logConfig['path'] . '/' . date('Y-m-d') . '.log', Monolog\Logger::ERROR)); return $log; }); //rbac管理服务 $service->set('rbacManage', function () { return new Service\rbac\Manage(); }); }