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


PHP CI_Model::__get方法代码示例

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


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

示例1: __get

 public function __get($name)
 {
     if ($name == 'table') {
         return $this->{$name};
     }
     return parent::__get($name);
 }
开发者ID:sleeping-lion,项目名称:slboard_codeigniter,代码行数:7,代码来源:SL.php

示例2: __get

 public function __get($property_name)
 {
     if (isset($this->{$property_name})) {
         return $this->{$property_name};
     }
     return parent::__get($property_name);
 }
开发者ID:BMOTech,项目名称:Cloud-POS,代码行数:7,代码来源:Ticket_model.php

示例3: __get

 public function __get($name)
 {
     $value = $this->getAttribute($name);
     if (!is_null($value)) {
         return $value;
     }
     return parent::__get($name);
 }
开发者ID:MUlt1mate,项目名称:cron-manager,代码行数:8,代码来源:DbBaseModel.php

示例4: __get

 public function __get($name)
 {
     if (array_key_exists($name, $this->attributes)) {
         return $this->attributes[$name];
     } else {
         return parent::__get($name);
     }
 }
开发者ID:kaabsimas,项目名称:caravana,代码行数:8,代码来源:MY_model.php

示例5: __get

 /**
  * @param string $name
  * @return mixed
  */
 public function __get($name)
 {
     if (!property_exists($this, $name)) {
         if (array_key_exists($name, $this->labels())) {
             $this->{$name} = "";
             return $this->{$name};
         }
     }
     return parent::__get($name);
 }
开发者ID:EASOL,项目名称:easol-docker,代码行数:14,代码来源:Easol_BaseEntity.php

示例6: __get

 /**
  * __get magic
  * @method __get
  * @param  mixed
  * @return mixed
  */
 public function __get($key)
 {
     // This method should be called when trying to access another Model, or to store results on an existing instance; so these are the only verifications we'll do here.
     // First, we have to check if we're trying to retrieve some attributes attached to the Manager only
     if (in_array($key, array('_models', '_map'))) {
         return $key;
     } else {
         $manager = get_instance()->{strtolower(get_class($this))};
         if (in_array($key, $manager->_models)) {
             return parent::__get($key);
         }
     }
     $debug = debug_backtrace();
     show_error('Cannot access undefined property \'' . $key . '\' of class ' . get_class($this) . '.<br /><br /><b>Filename :</b> ' . $debug[0]['file'] . '<br /><b>Function :</b> ' . $debug[1]['function'] . '<br /><b>Line number :</b> ' . $debug[0]['line']);
 }
开发者ID:gaudiauj,项目名称:model,代码行数:21,代码来源:MY_Model.php

示例7: __get

 /**
  * __get magic override
  * @method __get
  * @public
  * @param  string
  * @return object
  */
 public function __get($key)
 {
     // This method should ONLY be called when trying to access another CI's DB Object or model, so these are the only verifications we'll do here.
     if (strpos($key, 'db_') !== false) {
         if (!isset(CI()->{$key})) {
             CI()->{$key} = CI()->load->database(str_replace('db_', '', $key), TRUE);
             CI()->{$key}->initialize();
         }
         return parent::__get($key);
     } elseif (in_array($key, Manager()->getModels(get_class($this)))) {
         return CI()->{$key};
     }
     // Nothing returned, an error must be thrown
     $debug = debug_backtrace();
     show_error('Cannot access undefined property "' . $key . '" of class "' . get_class($this) . '".<br /><br /><b>Filename :</b> ' . $debug[0]['file'] . '<br /><b>Function :</b> ' . $debug[1]['function'] . '<br /><b>Line number :</b> ' . $debug[0]['line']);
 }
开发者ID:gccloud,项目名称:model,代码行数:23,代码来源:MY_Model.php

示例8:

 function __get($key)
 {
     if (isset($this->_attributes[$key])) {
         return $this->_attributes[$key];
     } else {
         return parent::__get($key);
     }
 }
开发者ID:rhizalpatrax64bit,项目名称:CodeIgniter-ORM,代码行数:8,代码来源:MY_Model.php

示例9: __get

 public function __get($name)
 {
     if ($name == 'db') {
         $this->_init_db();
         return self::$db_default;
     } else {
         return parent::__get($name);
     }
 }
开发者ID:linzequan,项目名称:miyaki,代码行数:9,代码来源:MY_Model.php

示例10: __get

 /**
  * 取得属性值
  * @param string $key
  * @return mixed
  */
 public function __get($key)
 {
     if (isset($this->attr[$key])) {
         return $this->attr[$key];
     } else {
         return parent::__get($key);
     }
 }
开发者ID:cranefly,项目名称:crane,代码行数:13,代码来源:mbase.php

示例11: __get

 /**
  * Returns a property value based on its name.
  * Do not call this method. This is a PHP magic method that we override
  * to allow using the following syntax to read a property or obtain event handlers:
  * <pre>
  * $value=$model->propertyName; [will be called $this->get_property_name()]
  * $value=$model->property_name; [will be called $this->get_property_name()]
  * $value=$model->load; [will be called $controller->load]
  * </pre>
  *
  * @param string $name the property name
  *
  * @return mixed the property value
  * @see __set
  */
 public function __get($name)
 {
     $getter = 'get' . $name;
     $getter2 = 'get_' . $name;
     $getter3 = 'get_' . self::underscore_from_camel_case($name);
     if (method_exists($this, $getter)) {
         return $this->{$getter}();
     } elseif (method_exists($this, $getter2)) {
         return $this->{$getter2}();
     } elseif (method_exists($this, $getter3)) {
         return $this->{$getter3}();
     }
     return parent::__get($name);
 }
开发者ID:andreffonseca,项目名称:ci-base-model,代码行数:29,代码来源:CI_Base_Model.php


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