assign[$name] = $value; } /** * 显示视图 * @param $file */ // public function display($file) // { // $file = APP.'/views/'.$file; // if (is_file($file)){ // extract($this->assign);#从数组中将变量导入到当前的符号表 // include $file; // } // } public function fetch($file = "") { $request = Request::getInstance(); if (!empty($this->assign)) { extract($this->assign); } if ($file) { $filename = ROOT_PATH . DIRECTORY_SEPARATOR . "view" . DIRECTORY_SEPARATOR . $file; } else { $filename = ROOT_PATH . DIRECTORY_SEPARATOR . "view" . DIRECTORY_SEPARATOR . $request->actionName . '.php'; } return require($filename); die(); } }