CodeIgniter Forums
How does CI handle multiple attempts to load the same file? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How does CI handle multiple attempts to load the same file? (/showthread.php?tid=43303)



How does CI handle multiple attempts to load the same file? - El Forum - 07-07-2011

[eluser]gunnarflax[/eluser]
If I load a library in my controller and then later also loads it within a model, does CI load it twice or abort the second attempt because it can see that it is already loaded?


How does CI handle multiple attempts to load the same file? - El Forum - 07-07-2011

[eluser]jmadsen[/eluser]
aborts


How does CI handle multiple attempts to load the same file? - El Forum - 07-07-2011

[eluser]davidbehler[/eluser]
CI loads libraries only once, no matter how often you use $this->load->library();. When ever a library is already loaded and you try to load it again an entry will be added to the log file that says so, this helps you find places in your code with unneeded function calls.


How does CI handle multiple attempts to load the same file? - El Forum - 07-07-2011

[eluser]gunnarflax[/eluser]
Great! Thank you for the elaborate answer!