コード例 #1
0
ファイル: App.php プロジェクト: ryanknu/zule-framework
 public function dispatch()
 {
     try {
         $controller = Router::Router()->getController();
         $action = Router::Router()->getAction();
         if ($controller->preRunFunction) {
             call_user_func([$controller, $controller->preRunFunction]);
         }
         if ($controller->canRespondToAction($action)) {
             call_user_func([$controller, $action]);
         } else {
             (new Error())->Action404();
         }
     } catch (Exception $e) {
         $c = new Error();
         $c->setException($e);
         $c->Action500();
     }
 }
コード例 #2
0
ファイル: index.php プロジェクト: ryanknu/zule-key-manager
<?php

namespace Zule;

use Zule\Tools\Router;
use Zule\Controllers\Error;
use Exception;
require_once '../tools/Main.php';
try {
    $controller = Router::Router()->getController();
    $action = Router::Router()->getAction();
    if ($controller->preRunFunction) {
        call_user_func([$controller, $controller->preRunFunction]);
    }
    if ($controller->canRespondToAction($action)) {
        call_user_func([$controller, $action]);
    } else {
        (new Error())->Action404();
    }
} catch (Exception $e) {
    $c = new Error();
    $c->setException($e);
    $c->Action500();
}