public function dispatch() { $model_info = $this->router()->parse_url(); if (empty($model_info)) { //$this->_response->res('404'); echo '404 The page is not exist!'; exit; //@todo 由<接收响应机制> } $app = $model_info['app']; $module = $model_info['module']; $action = $model_info['action'] ? $model_info['action'] : ($model_info['parameter']['action'] ? $model_info['parameter']['action'] : ''); $default = $model_info['default']; $parameter = $model_info['parameter']; $this->_request->set_param($parameter, $default); $controller = ucfirst($module) . ucfirst($app) . 'Con'; //call function and write response in the class reponse if (!method_exists(Blood::single($controller), $action)) { echo '404 The page is not exist!'; exit; } else { Blood::single($controller)->{$action}(); } //$this->_response->sendhttphead(); $response = $this->_response->get_body(); echo $response; }
public function model($model_name = '') { if (class_exists($model_name)) { return Blood::single($model_name); } else { $ex_res = NutrientLib::class_explode(get_class($this)); array_pop($ex_res); return Blood::single(implode('', $ex_res) . 'Mod'); } }