當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FrontController::retrieveMethod方法代碼示例

本文整理匯總了PHP中FrontController::retrieveMethod方法的典型用法代碼示例。如果您正苦於以下問題:PHP FrontController::retrieveMethod方法的具體用法?PHP FrontController::retrieveMethod怎麽用?PHP FrontController::retrieveMethod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FrontController的用法示例。


在下文中一共展示了FrontController::retrieveMethod方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: dispatch

 /**
  * Static method that dispatches a controller based on the provided controller and action name
  *
  * @param string             $controller the name of the controller without the trailing word Controller, e.g. Index as opposed to IndexController
  * @param string             $action the name of the action without the trailing word Action, e.g. index as opposed to indexAction
  * @return object
  */
 public static function dispatch($controller = "Index", $action = "index")
 {
     try {
         $controllerName = $controller . "Controller";
         $controllerLocation = FrontController::retrieveControllerFileLocation($controllerName);
         if (!file_exists($controllerLocation)) {
             throw new Exception($controllerName . ".class.php does not exist");
         }
         include $controllerLocation;
         eval("\$object = new " . $controllerName . "();");
         $object->__set("action", $action);
         $object->__set("controller", $controller);
         $object->__set("controllerName", $controllerName);
         $object->__set("url", FrontController::retrieveURL());
         $object->__set("method", FrontController::retrieveMethod());
         $object->__set("model", FrontController::retrieveModel($controller));
         $object->__set("view", new View($controller, $action));
         if (method_exists($object, "initialize")) {
             $annotationFactory = new AnnotationFactory($controllerLocation, "initialize");
             $object->initialize();
         }
         return $object;
     } catch (Exception $e) {
         Functions::dump($e->getMessage());
         return NULL;
     }
 }
開發者ID:Romayne,項目名稱:MVC-MVVM-Annotations-Framework,代碼行數:34,代碼來源:FrontController.class.php


注:本文中的FrontController::retrieveMethod方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。