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


PHP Router::instance方法代码示例

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


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

示例1: getInstance

 public static function getInstance()
 {
     if (self::$instance === null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:nurtext,项目名称:sprout,代码行数:7,代码来源:Router.class.php

示例2: getInstance

 public static function getInstance($reset = false)
 {
     if (null === Router::$instance || $reset) {
         Router::$instance = new Router();
     }
     return Router::$instance;
 }
开发者ID:matthewdunbar11,项目名称:PHPTenant,代码行数:7,代码来源:router.php

示例3: getInstance

 /**
  * 
  * @return Router
  */
 public static function getInstance($index)
 {
     if (!isset(self::$instance)) {
         self::$instance = new self($index);
     }
     return self::$instance;
 }
开发者ID:exildev,项目名称:q-stad,代码行数:11,代码来源:Router.php

示例4: instance

 public static function instance($uri)
 {
     if (!self::$instance instanceof Router) {
         self::$instance = new Router($uri);
     }
     return self::$instance;
 }
开发者ID:adrianpl20,项目名称:oop,代码行数:7,代码来源:router.php

示例5: getInstance

 /**
  * Ensure the Router object is a singleton.
  * 
  * @return Router single instance.
  * @author anza
  */
 public static function getInstance($registry)
 {
     if (!self::$instance) {
         self::$instance = new Router($registry);
     }
     return self::$instance;
 }
开发者ID:anzasolutions,项目名称:simland,代码行数:13,代码来源:Router.class.php

示例6: me

 public static function me()
 {
     if (is_null(self::$instance)) {
         self::$instance = new Router();
     }
     return self::$instance;
 }
开发者ID:kostarev,项目名称:test,代码行数:7,代码来源:Router.php

示例7: __construct

 public function __construct($config)
 {
     $this->_objects['app'] = App::instance();
     $this->_objects['router'] = Router::instance();
     $this->_objects['inputs'] = Inputs::instance();
     $this->_objects['session'] = Session::instance();
     $this->_objects['log'] = Log::factory();
     if (!isset($this->app->config['database']['redis'][$config['serverId']])) {
         $config['serverId'] = 0;
     }
     $current = $this->app->config['database']['redis'][$config['serverId']];
     $current['serverId'] = $config['serverId'];
     $this->_objects['db'] = Db::factory($current);
     $this->_objects['infoModel'] = new Info_Model($current);
     $info = $this->db->info();
     $dbs = $this->infoModel->getDbs($info);
     if (!isset($current['max_databases'])) {
         $databasesConfig = $this->_objects['db']->config('GET', 'databases');
         $current['max_databases'] = $databasesConfig['databases'];
     }
     // Take care of invalid dbId's. If invalid, set to first available database
     if (!is_numeric($config['dbId']) || $config['dbId'] < 0 || $config['dbId'] >= $current['max_databases']) {
         $config['dbId'] = $dbs[0];
     }
     $current['newDB'] = !in_array($config['dbId'], $dbs) ? true : false;
     $current['database'] = $config['dbId'];
     // Extract number of keys
     foreach ($dbs as $i) {
         if (preg_match('/^keys=([0-9]+),expires=([0-9]+)/', $info["db{$i}"], $matches)) {
             $current['dbs'][$i] = array('id' => $i, 'keys' => $matches[1], 'name' => isset($current['dbNames'][$i]) ? $current['dbNames'][$i] : null);
         }
     }
     $this->db->select($current['database']);
     $this->app->current = $current;
 }
开发者ID:BlackIkeEagle,项目名称:phpredmin,代码行数:35,代码来源:controller.php

示例8: self

 static function &getInstance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:ahmed555,项目名称:Cupcake,代码行数:7,代码来源:router.php

示例9: singleton

 public static function singleton()
 {
     if (!isset(self::$instance)) {
         $c = __CLASS__;
         self::$instance = new $c();
     }
     return self::$instance;
 }
开发者ID:radicaldesigns,项目名称:gtd,代码行数:8,代码来源:Router.php

示例10: disconnect

 static function disconnect()
 {
     if (!self::open()) {
         return null;
     }
     self::$instance->disconnect();
     self::$instance = null;
 }
开发者ID:phone1246,项目名称:mikrotik,代码行数:8,代码来源:routerController.php

示例11: __construct

 public function __construct()
 {
     ini_set('output_buffering', 'On');
     ini_set('short_open_tag', 'On');
     $this->_dir = '../views/';
     $this->app = App::instance();
     $this->router = Router::instance();
 }
开发者ID:xxoxx,项目名称:phpredmin,代码行数:8,代码来源:php.php

示例12: model

 static function model($name)
 {
     Router::instance()->loadModel($name);
     //print $x ? '111' :  '222';
     $className = ucfirst($name) . 'Model';
     // print($name);
     return new $className();
 }
开发者ID:RoykoSerhiy,项目名称:php_projects,代码行数:8,代码来源:Zed.php

示例13: __construct

 public function __construct($config)
 {
     $this->_objects['app'] = App::instance();
     $this->_objects['router'] = Router::instance();
     $this->_objects['session'] = Session::instance();
     $this->_objects['db'] = Db::factory($config);
     $this->_objects['log'] = Log::factory();
 }
开发者ID:xxoxx,项目名称:phpredmin,代码行数:8,代码来源:model.php

示例14: assemble_url

/**
 * Assemble URL based on a specific route
 * 
 * Supported options:
 * 
 * - url_base (string): base for URL-s, default is an empty string
 * - query_arg_separator (string): what to use to separate query string 
 *   arguments, default is '&'
 * - anchor (string): name of the URL anchor
 *
 * @param string $name
 * @param array $params
 * @param array $options
 * @return string
 */
function assemble_url($name, $params = null, $options = null)
{
    static $instance;
    if ($instance === null) {
        $instance =& Router::instance();
    }
    // if
    return $instance->assemble($name, $params, $options);
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:24,代码来源:init.php

示例15: _getRequest

 private static function _getRequest()
 {
     if (self::$_request === NULL) {
         $router = Router::instance();
         // TODO: Try to access the previously matched object
         self::$_request = $router->match(ANGIE_PATH_INFO, ANGIE_QUERY_STRING);
     }
     return self::$_request;
 }
开发者ID:nischu7,项目名称:ac-304,代码行数:9,代码来源:ThreeOFourCore.class.php


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