Last active
December 18, 2015 14:09
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* __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