芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/public_html/fmd/vendor/akrabat/rka-slim-controller/RKA/Slim.php
createControllerClosure($callable); } $args[] = $callable; return parent::mapRoute($args); } /** * Create a closure that instantiates (or gets from container) and then calls * the action method. * * Also if the methods exist on the controller class, call setApp(), setRequest() * and setResponse() passing in the appropriate object. * * @param string $name controller class name and action method name separated by a colon * @return closure */ protected function createControllerClosure($name) { list($controllerName, $actionName) = explode(':', $name); // Create a callable that will find or create the controller instance // and then execute the action $app = $this; $callable = function () use ($app, $controllerName, $actionName) { // Try to fetch the controller instance from Slim's container if ($app->container->has($controllerName)) { $controller = $app->container->get($controllerName); } else { // not in container, assume it can be directly instantiated $controller = new $controllerName($app); } // Set the app, request and response into the controller if we can if (method_exists($controller, 'setApp')) { $controller->setApp($app); } if (method_exists($controller, 'setRequest')) { $controller->setRequest($app->request); } if (method_exists($controller, 'setResponse')) { $controller->setResponse($app->response); } // Call init in case the controller wants to do something now that // it has an app, request and response. if (method_exists($controller, 'init')) { $controller->init(); } return call_user_func_array(array($controller, $actionName), func_get_args()); }; return $callable; } }