當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。