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


PHP router::set_class方法代码示例

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


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

示例1: add_controller_tracks

 public function add_controller_tracks()
 {
     $this->add_track('default', function () {
         return router::get_controller();
     });
     $this->add_track('class_method', function () {
         $controller_name = '\\' . self::$myrep . '\\' . router::get_class() . '\\' . router::get_method() . '\\controller';
         self::$prv_class = router::get_class();
         return $this->check_controller($controller_name);
     });
     $this->add_track('class_home', function () {
         if ((!isset(self::$url_property[1]) || self::$url_property[1] != router::get_method()) && router::get_method() != 'home') {
             router::add_url_property(router::get_method());
         }
         self::$prv_method = router::get_method();
         router::set_method('home');
         $controller_name = '\\' . self::$myrep . '\\' . router::get_class() . '\\' . router::get_method() . '\\controller';
         return $this->check_controller($controller_name);
     });
     $this->add_track('class', function () {
         router::set_class(self::$prv_class);
         $controller_name = '\\' . self::$myrep . '\\' . router::get_class() . '\\controller';
         return $this->check_controller($controller_name);
     });
     $this->add_track('home_home', function () {
         if ((!isset(self::$url_property[0]) || self::$url_property[0] != router::get_class()) && router::get_class() != 'home') {
             router::add_url_property(router::get_class());
         }
         router::set_class('home');
         $controller_name = '\\' . self::$myrep . '\\' . router::get_class() . '\\' . router::get_method() . '\\controller';
         return $this->check_controller($controller_name);
     });
     $this->add_track('home', function () {
         router::set_class('home');
         $controller_name = '\\' . self::$myrep . '\\' . router::get_class() . '\\controller';
         return $this->check_controller($controller_name);
     });
 }
开发者ID:Ermile,项目名称:Saloos,代码行数:38,代码来源:main.php

示例2: loadController

 public function loadController()
 {
     /**
      * find controller;
      */
     $url_property = router::get_url_property(-1);
     $myrep = router::get_repository_name();
     if (!router::get_controller()) {
         $controller_name = '\\' . $myrep . '\\' . router::get_class() . '\\' . router::get_method() . '\\controller';
         $prv_class = router::get_class();
         // var_dump($controller_name);
         if (!class_exists($controller_name)) {
             if ((!isset($url_property[1]) || $url_property[1] != router::get_method()) && router::get_method() != 'home') {
                 router::add_url_property(router::get_method());
             }
             $prv_method = router::get_method();
             router::set_method('home');
             $controller_name = '\\' . $myrep . '\\' . router::get_class() . '\\' . router::get_method() . '\\controller';
             // var_dump(router::get_url_property(-1));
             // var_dump($controller_name);
             if (!class_exists($controller_name)) {
                 router::set_class($prv_class);
                 $controller_name = '\\' . $myrep . '\\' . router::get_class() . '\\controller';
                 // var_dump(router::get_url_property(-1));
                 // var_dump($controller_name);
                 if (!class_exists($controller_name)) {
                     if ((!isset($url_property[0]) || $url_property[0] != router::get_class()) && router::get_class() != 'home') {
                         router::add_url_property(router::get_class());
                     }
                     router::set_class('home');
                     $controller_name = '\\' . $myrep . '\\' . router::get_class() . '\\' . router::get_method() . '\\controller';
                     // var_dump(router::get_url_property(-1));
                     // var_dump($controller_name);
                     //
                     if (!class_exists($controller_name)) {
                         router::set_class('home');
                         $controller_name = '\\' . $myrep . '\\' . router::get_class() . '\\controller';
                         // var_dump(router::get_url_property(-1));
                         // $controller_name='\account\home\controller';
                         // var_dump($controller_name);
                         if (!class_exists($controller_name)) {
                             \lib\error::page("content not found");
                         }
                     }
                 }
             }
         }
     } else {
         $controller_name = router::get_controller();
     }
     router::set_controller($controller_name);
     if (!class_exists($controller_name)) {
         error::page($controller_name);
     }
     $controller = new $controller_name();
     self::$controller = $controller;
     // running template base module for homepage
     if (\lib\router::get_storage('CMS') && $myrep == 'content' && method_exists($controller, 's_template_finder')) {
         $controller->s_template_finder();
     }
     if (method_exists($controller, '_route')) {
         $controller->_route();
     }
     if (router::get_controller() !== $controller_name) {
         $this->loadController();
         return;
     }
     if (method_exists($controller, 'config')) {
         $controller->config();
     }
     if (method_exists($controller, 'options')) {
         $controller->options();
     }
     if (count(router::get_url_property(-1)) > 0 && $controller->route_check_true === false) {
         error::page('Unavailable');
     }
     $controller->_corridor();
 }
开发者ID:evazzadeh,项目名称:Saloos,代码行数:78,代码来源:main.php


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