Skip to content

Instantly share code, notes, and snippets.

@peterfox
Last active December 18, 2015 14:09
Show Gist options
  • Save peterfox/5795620 to your computer and use it in GitHub Desktop.
Save peterfox/5795620 to your computer and use it in GitHub Desktop.
Example of the code that can be used to bring the same functionality from the Model/CI_Model of CodeIgniter to other classes that want to access CodeIgniter fields as if they were attached to the class itself
/**
* __get
*
* Allows models to access CI's loaded classes using the same
* syntax as controllers.
*
* @param string
* @access private
*/
function __get($key)
{
$CI =& get_instance();
return $CI->$key;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment