コード例 #1
0
 /**
  * @brief 请求执行方法,是application执行的入口方法
  */
 public function execRequest()
 {
     IUrl::beginUrl();
     $this->controller = $this->createController();
     IInterceptor::run("onCreateController");
     $this->controller->run();
     IInterceptor::run("onFinishController");
 }
コード例 #2
0
 /**
  * @brief 请求执行方法,是application执行的入口方法
  */
 public function execRequest()
 {
     echo IWeb::exeTime() . "<br><br><br>";
     IUrl::beginUrl();
     $this->controller = $this->createController();
     IInterceptor::run("onCreateController", $this->controller);
     $this->controller->run();
     IInterceptor::run("onFinishController");
 }
コード例 #3
0
ファイル: view_action.php プロジェクト: xzdesk/iwebshop.com
 /**
  * @brief 执行视图渲染
  * @return 视图
  */
 public function run()
 {
     $controller = $this->getController();
     IInterceptor::run("onCreateView", $controller);
     $this->resolveView($this->getView());
     $data = null;
     if (file_exists($this->view . $controller->extend)) {
         $controller->render($this->view, $data);
     } else {
         $path = $this->view . $controller->extend;
         $path = IException::pathFilter($path);
         IError::show("not found this view page({$path})", 404);
     }
     IInterceptor::run("onFinishView");
 }
コード例 #4
0
ファイル: view_action.php プロジェクト: yongge666/sunupedu
 /**
  * @brief 执行视图渲染
  * @return 视图
  */
 public function run()
 {
     $controller = $this->getController();
     IInterceptor::run("onCreateView", $controller);
     $this->resolveView($this->getView());
     $data = null;
     if (file_exists($this->view . $controller->extend)) {
         $controller->render($this->view, $data);
     } else {
         $path = $this->view . $controller->extend;
         $path = IException::pathFilter($path);
         $data = array('title' => 'HTTP 404', 'heading' => 'not found', 'message' => "not found this view page({$path})");
         throw new IHttpException($data, 404);
     }
     IInterceptor::run("onFinishView");
 }
コード例 #5
0
 /**
  * @brief 应用运行的方法
  * @return Void
  */
 public function run()
 {
     IInterceptor::run("onCreateApp");
     $this->execRequest();
     IInterceptor::run("onFinishApp");
 }
コード例 #6
0
 /**
  * @brief 视图重定位
  * @param string $next     下一步要执行的动作或者路径名,注:当首字符为'/'时,则支持跨控制器操作
  * @param bool   $location 是否重定位 true:是 false:否
  */
 public function redirect($nextUrl, $location = true, $data = null)
 {
     if (strpos($nextUrl, 'http') === 0) {
         header('location: ' . $nextUrl);
         IWeb::$app->end(0);
     }
     //获取当前的action动作
     $actionId = IReq::get('action');
     if ($actionId === null) {
         $actionId = $this->defaultAction;
     }
     //分析$nextAction 支持跨控制器跳转
     $nextUrl = strtr($nextUrl, '\\', '/');
     if ($nextUrl[0] != '/') {
         //重定跳转定向
         if ($actionId != $nextUrl && $location == true) {
             $locationUrl = IUrl::creatUrl('/' . $this->ctrlId . '/' . $nextUrl);
             header('location: ' . $locationUrl);
             IWeb::$app->end(0);
         } else {
             $this->action = new IViewAction($this, $nextUrl);
             $this->action->run();
         }
     } else {
         $urlArray = explode('/', $nextUrl, 4);
         $ctrlId = isset($urlArray[1]) ? $urlArray[1] : '';
         $nextAction = isset($urlArray[2]) ? $urlArray[2] : '';
         //重定跳转定向
         if ($location == true) {
             //url参数
             if (isset($urlArray[3])) {
                 $nextAction .= '/' . $urlArray[3];
             }
             $locationUrl = IUrl::creatUrl('/' . $ctrlId . '/' . $nextAction);
             header('location: ' . $locationUrl);
             IWeb::$app->end(0);
         } else {
             $nextCtrlObj = new $ctrlId($this->module, $ctrlId);
             IInterceptor::run("onCreateController", $nextCtrlObj);
             //跨控制器渲染数据
             if ($data) {
                 $nextCtrlObj->setRenderData($data);
             }
             $nextCtrlObj->init();
             $nextViewObj = new IViewAction($nextCtrlObj, $nextAction);
             $nextViewObj->run();
         }
     }
 }
コード例 #7
0
 /**
  * @brief 执行action方法
  */
 public function run()
 {
     //开启缓冲区
     ob_start();
     header("content-type:text/html;charset=" . $this->module->charset);
     //初始化控制器
     $this->init();
     //创建action对象
     $actionObj = $this->createAction();
     IInterceptor::run("onCreateAction");
     $actionObj->run();
     IInterceptor::run("onFinishAction");
     //处理缓冲区
     die(trim(ob_get_clean()));
 }
コード例 #8
0
 /**
  * @brief 执行action方法
  */
 public function run()
 {
     //开启缓冲区
     ob_start();
     ob_implicit_flush(false);
     header("content-type:text/html;charset=" . $this->module->getCharset());
     //初始化控制器
     $this->init();
     //创建action对象
     IInterceptor::run("onCreateAction");
     $actionObj = $this->createAction();
     $actionObj->run();
     IInterceptor::run("onFinishAction");
     flush();
     IWeb::$app->end(0);
 }
コード例 #9
0
 /**
  * @brief 应用运行的方法
  * @return Void
  */
 public function run()
 {
     echo "拦截器注册完成666666666<br>";
     IInterceptor::run("onCreateApp");
     echo "注册onCreateApp拦截器<br>";
     echo "执行IWebApplication:execRequest()方法<br>";
     $this->execRequest();
     IInterceptor::run("onFinishApp");
 }