/**
  *
  * @param ZcAction $action
  * @param ZcAction $error
  */
 private function execute($action, $error)
 {
     if (file_exists($action->getFile())) {
         //加载语言
         ZcFactory::getLanguageObject()->loadControllerLanguageByRoute($action->getRoute());
         //实例化类
         require_once $action->getFile();
         $class = $action->getClass();
         $controller = new $class($action->getRoute());
         if (is_callable(array($controller, $action->getMethod()))) {
             if (is_callable(array($controller, 'beforeAction'))) {
                 call_user_func_array(array($controller, 'beforeAction'), array());
             }
             $action = call_user_func_array(array($controller, $action->getMethod()), $action->getArgs());
             if (is_callable(array($controller, 'afterAction'))) {
                 call_user_func_array(array($controller, 'afterAction'), array());
             }
         } else {
             $action = $error;
         }
     } else {
         $action = $error;
     }
     return $action;
 }
Beispiel #2
0
 /**
  * 引用某个语言文件
  * @param file 绝对路径文件名称
  * @param lang 语言类型 默认是<b>english</b>
  * @param string $key
  */
 public static function loadLanguageFile($file, $lang = 'english')
 {
     return ZcFactory::getLanguageObject()->loadByFile($file, $lang);
 }