Autoload function - 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: Autoload function (/showthread.php?tid=72881) |
Autoload function - Skinper - 02-24-2019 Hello, I have some doubts about autoload in CodeIgniter. My first question is that currently, I use __autoload, it has been discontinued? Is not it good practice to use it? I read about the spl_autoload_register, is it better to use it instead of __autoload? Also, my other doubt is related to server demand when using autoload, does it load EVERYTHING as soon as the server is loaded or is it on demand? Because if it loads everything, it would not be good to put many includes there, right? Thanks a lot ! RE: Autoload function - InsiteFX - 02-24-2019 For auto loading of base controller classes in core folder. Can be modified to load other folders as well. PHP Code: // ----------------------------------------------------------------------- RE: Autoload function - Skinper - 02-24-2019 Is it a good practice to have all includes what I will need within the autoload? Is it on demand? Thanks! RE: Autoload function - dave friend - 02-24-2019 (02-24-2019, 06:23 AM)Skinper Wrote: Hello, I have some doubts about autoload in CodeIgniter. You should use spl_autoload_register instead of __autoload. __autoload has been DEPRECATED as of PHP 7.2.0. Relying on this feature is highly discouraged. The registered autoload function loads only the requested file on demand. RE: Autoload function - Skinper - 02-25-2019 What is the best way to make autoload incldues? such as: include_once (DIR_LIB. "interface / components / TinyMce.php"); Thanks a lot for help! RE: Autoload function - dave friend - 02-25-2019 (02-25-2019, 10:19 AM)Skinper Wrote: What is the best way to make autoload incldues? "Best Way" is subjective and depends on a bunch of factors that require more time to explain that I have time for (Sorry ), but it mostly boils down to one or more of the following.
|