Accessing CI object from Library - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Accessing CI object from Library (/showthread.php?tid=72177) |
Accessing CI object from Library - neuron - 11-14-2018 Hi, most of the times I see CI object is accessed from library in following way: PHP Code: $ci = &get_instance(); But in Codeigntier Ion Auth library they accessed as if they not in library. Here is contructor of Ion Auth Library. PHP Code: public function __construct() How it is accessed using $this in this library? The link to code: https://github.com/benedmunds/CodeIgniter-Ion-Auth/blob/2/libraries/Ion_auth.php RE: Accessing CI object from Library - InsiteFX - 11-14-2018 It's using the php magic method __get() PHP Code: /** Hope that helps. RE: Accessing CI object from Library - neuron - 11-14-2018 never used magic methods. now I know thanks |