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


PHP View::setView方法代碼示例

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


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

示例1: loadController

 /**
  * Load controller
  * 
  * @param array $cmv array('controller' => '', 'method' => '', 'vars' => array())
  */
 private function loadController($cmv)
 {
     //if we have nothing to do, then quit
     if (empty($cmv) or empty($cmv['controller']) or empty($cmv['method'])) {
         trigger_error('Not call controller->method', E_USER_ERROR);
         exit;
     }
     if (!is_array($cmv['controller'])) {
         $cmv['controller'] = array($cmv['controller']);
     }
     self::$controller = implode("\\", $cmv['controller']);
     self::$method = $cmv['method'];
     $this->view->setView(self::$controller . DS . self::$method);
     //add controllers folder to begin and uppercase first letter class name
     array_unshift($cmv['controller'], 'controllers');
     end($cmv['controller']);
     $cmv['controller'][key($cmv['controller'])] = ucfirst($cmv['controller'][key($cmv['controller'])]);
     $cmv['controller'] = "\\" . implode("\\", $cmv['controller']);
     $controller = new $cmv['controller']($this->config, $this->router, $this->view);
     if (method_exists($controller, 'beforeMethod')) {
         Debug::timer('beforeMethod');
         $controller->beforeMethod();
         Debug::timer('beforeMethod');
     }
     if (is_callable(array($controller, $cmv['method']), true)) {
         Debug::timer('Controller logic');
         call_user_func_array(array($controller, $cmv['method']), $cmv['vars']);
         Debug::timer('Controller logic');
     }
     if (method_exists($controller, 'afterMethod')) {
         Debug::timer('afterMethod');
         $controller->afterMethod();
         Debug::timer('afterMethod');
     }
 }
開發者ID:stefanak-michal,項目名稱:DragonMVC,代碼行數:40,代碼來源:Dragon.php


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