当前位置: 首页>>代码示例>>PHP>>正文


PHP Load::controller方法代码示例

本文整理汇总了PHP中Load::controller方法的典型用法代码示例。如果您正苦于以下问题:PHP Load::controller方法的具体用法?PHP Load::controller怎么用?PHP Load::controller使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Load的用法示例。


在下文中一共展示了Load::controller方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: parseRoute

 protected function parseRoute()
 {
     // parse the route from the URL
     if (!empty($this->Uri->uri_parts)) {
         $controller = $this->Uri->uri_parts[0];
         if (isset($this->Uri->uri_parts[1])) {
             $method = $this->Uri->uri_parts[1];
         }
     }
     // use default if no controller has been found
     if (empty($controller)) {
         $controller = $this->Config->get('default.controller');
     }
     // use default if no method has been found
     if (empty($method)) {
         $method = $this->Config->get('default.method');
     }
     // for controllers with multiple words in their name
     $controller = str_replace('-', ' ', $controller);
     // convert class name into expected casing
     $controller = ucwords($controller);
     // remove any spaces to give final controller name
     $controller = str_replace(' ', '', $controller);
     try {
         // init controller
         $this->Controller = Load::controller($controller);
     } catch (LoadException $e) {
         throw new Exception('ROUTER_INVALID_CONTROLLER');
     }
     // ensure method exists
     if (!method_exists($this->Controller, $method)) {
         throw new Exception('ROUTER_INVALID_METHOD');
     }
     // call the method
     $this->Method = call_user_func(array($this->Controller, $method));
     // call draw method
     $this->Draw = call_user_func(array($this->Controller, '_draw'));
 }
开发者ID:aboxall,项目名称:v0.1-legacy,代码行数:38,代码来源:Router.php

示例2: bstatus

 function bstatus()
 {
     Load::controller('bstatus');
 }
开发者ID:etuyco,项目名称:v2.inlight-marketing,代码行数:4,代码来源:admin.php

示例3: toCamelCase

            exit;
        }
    }
    //если запрошена главная страница админки - выводим ее шаблон
    if ($_SERVER['REQUEST_URI'] === '/admin/') {
        FileSys::includeFile(ADMIN_ROOT . '/templates/default/index.php');
    } else {
        $com = Request::get('com');
        if (!is_dir(ADMIN_ROOT . '/components/' . $com)) {
            Router::set404();
        }
        if (is_file(ADMIN_ROOT . '/components/' . $com . '/config.php')) {
            require_once ADMIN_ROOT . '/components/' . $com . '/config.php';
        }
        if (is_file(ADMIN_ROOT . '/components/' . $com . '/SectionController.php')) {
            Load::controller(ADMIN_ROOT . '/components/' . $com . '/SectionController.php', Request::get('section', false));
        } else {
            $com_dirs = FileSys::getDirs(ADMIN_ROOT . '/components/' . $com);
            $forbidden_dir = ['client'];
            $section = Request::get('section');
            if (in_array($section, $com_dirs) && !in_array($section, $forbidden_dir)) {
                Load::manager(ADMIN_ROOT . '/components/' . $com . '/' . $section . '/' . toCamelCase($section) . 'Manager.php');
            } else {
                Router::set404();
            }
        }
    }
} catch (SystemException $e) {
    header('HTTP/1.0 500 Internal Server Error');
    echo $e->getError();
} catch (ValidatorException $e) {
开发者ID:pavel78779,项目名称:my_cms,代码行数:31,代码来源:index.php

示例4: helpers

 public function helpers()
 {
     Load::controller(__DIR__ . '/helpers/HelpersController.php', Request::get('action'));
 }
开发者ID:pavel78779,项目名称:my_cms,代码行数:4,代码来源:SectionController.php

示例5: manager

 public static function manager($path)
 {
     Load::controller($path, Request::get('action', false));
 }
开发者ID:pavel78779,项目名称:my_cms,代码行数:4,代码来源:Load.php


注:本文中的Load::controller方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。