コード例 #1
0
ファイル: controller.php プロジェクト: fixbugs/pubfunc-php
 /**
  * 运行初始化程序
  * 本实例运行单请求,简单路由功能
  */
 public function execute($plugins)
 {
     $myPlugins = array('Leb_Request' => array(), 'Leb_Dispatcher' => array());
     // MVC 完毕
     $result = parent::execute($myPlugins);
     return $result;
 }
コード例 #2
0
 /**
  * 实现分发
  * 为了分发前能执行其他操作,所以把要分发的几个变量进行修改
  * 如可以实现分发前重定向,所以你要写几个后插插件
  * 如权限控制插件需写成后分发插件
  *
  * @param Leb_Plugin_Abstract $plugins 通常是$this
  * @return Leb_Plugin_Abstract
  */
 protected function _afterLaunch($plugins = null)
 {
     parent::_afterLaunch($plugins);
     try {
         $appPath = $plugins->getAppName();
         $controllerName = $plugins->getControllerName();
         $actionName = $plugins->getActionName();
         $this->dispatch($appPath, $controllerName, $actionName, array(), $plugins);
     } catch (Leb_Exception $e) {
         throw $e;
     }
     return $plugins;
 }
コード例 #3
0
 /**
  * 动态获得model 以便于不用显式加载model
  * $key对应相应的Model类
  *
  * @example
  * $this->__task表示获得是应用级的model
  * $this->_task表示模块级的model
  *
  * @param string $key
  */
 public function __get($key)
 {
     if ('__' == substr($key, 0, 2)) {
         $model = substr($key, 2);
         return $this->loadAppModel($model);
     } else {
         $prefix = substr($key, 0, 1);
         if ('_' == $prefix) {
             $model = substr($key, 1);
             return $this->loadModel($model);
         } else {
             return parent::__get($key);
         }
     }
 }