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


PHP registry::instance方法代码示例

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


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

示例1: __construct

 /**
  * Session Constructor
  *
  * The constructor runs the session routines automatically
  * whenever the class is instantiated.
  */
 public function __construct()
 {
     // Set the super object to a local variable for use throughout the class
     $this->registry =& registry::instance();
     // Do we need use cookie? If so, load the input library
     $this->registry->load->library('input');
     // Do we need encryption? If so, load the encryption library
     if ($this->session_encrypt_cookie == true) {
         $this->registry->load->library('encrypt');
     }
     // Set the "now" time.  Can either be GMT or server time, based on the
     // config prefs.  We use this to set the "last activity" time
     $this->now = $this->_get_time();
     // Set the session length. If the session expiration is
     // set to zero we'll set the expiration two years from now.
     if ($this->session_expiration == 0) {
         $this->session_expiration = 60 * 60 * 24 * 365 * 2;
     }
     // Set the cookie name
     $this->session_cookie_name = $this->cookie_prefix . $this->session_cookie_name;
     // Run the Session routine. If a session doesn't exist we'll
     // create a new one.  If it does, we'll update it.
     if (!$this->session_read()) {
         $this->session_create();
     } else {
         $this->session_update();
     }
 }
开发者ID:hymns,项目名称:phphyppo,代码行数:34,代码来源:session.php

示例2: __construct

 /**
  * class constructor
  *
  * @access	public
  */
 public function __construct()
 {
     // set the class instance
     registry::instance($this);
     // instantiate loader engine
     $this->load = new AppLoader();
     // instantiate viewer engine
     $this->view = new AppViewer();
 }
开发者ID:hymns,项目名称:phphyppo,代码行数:14,代码来源:AppController.php

示例3: __construct

 /**
  * class constructor
  *
  * @access	public
  */
 public function __construct()
 {
     // global objects
     foreach (array_keys(get_object_vars(registry::instance())) as $object) {
         if (!isset($this->{$object})) {
             $this->{$object} = registry::instance()->{$object};
         }
     }
     // load database library
     $this->db = $this->load->database();
 }
开发者ID:hymns,项目名称:phphyppo,代码行数:16,代码来源:AppModel.php

示例4: getInstance

 public static function getInstance()
 {
     //there is no instance
     if (!self::$instance instanceof self) {
         //si el instance es una instancia de si mismo
         self::$instance = new self();
         return self::$instance;
     } else {
         return self::$instance;
     }
 }
开发者ID:carlos195,项目名称:template,代码行数:11,代码来源:registry.php

示例5: model

 /**
  * model
  *
  * load a model object
  *
  * @access	public
  * @param	string $model_name the name of the model class
  * @param	string $alias_name the property name alias
  * @param	string $filename the filename
  * @return	boolean
  */
 public function model($model_name, $alias_name = null, $filename = null)
 {
     // if no alias,  use the model name
     if (!isset($alias_name)) {
         $alias_name = $model_name;
     }
     // final check for model alias
     if (empty($alias_name)) {
         throw new Exception('Model name cannot be empty', 205);
     }
     // check valid alias name
     if (!preg_match('!^[a-zA-Z][a-zA-Z_]+$!', $alias_name)) {
         throw new Exception('Model name "' . $alias_name . '" is an invalid format', 206);
     }
     // check reserved alias name
     if (method_exists($this, $alias_name)) {
         throw new Exception('Model name "' . $alias_name . '" is an invalid (reserved) name', 207);
     }
     // model already loaded? skip
     if (isset($this->{$alias_name})) {
         return true;
     }
     // if no filename, use the lower-case model name
     if (!isset($filename)) {
         $filename = strtolower($model_name);
     }
     // assign application model path
     $filepath = APPDIR . 'models' . DS . $filename . '.php';
     // check application model path
     if (!file_exists($filepath)) {
         throw new Exception($model_name, 208);
     }
     // no problem, load application model class
     require_once $filepath;
     // class name must be the same as the model name
     if (!class_exists($model_name)) {
         throw new Exception($model_name, 209);
     }
     // get instance of registry object
     $registry = registry::instance();
     // instantiate the object as a property
     $registry->{$alias_name} = new $model_name();
     return true;
 }
开发者ID:hymns,项目名称:phphyppo,代码行数:55,代码来源:AppLoader.php

示例6:

/**
 * get_instance
 *
 * set & get the registry object instance function
 *
 * @access public
 */
function &get_instance($new_instance = null)
{
    return registry::instance($new_instance);
}
开发者ID:hymns,项目名称:phphyppo,代码行数:11,代码来源:AppRegistry.php


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