Autoload function |
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 ! ![]()
For auto loading of base controller classes in core folder.
Can be modified to load other folders as well. PHP Code: // ----------------------------------------------------------------------- What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Is it a good practice to have all includes what I will need within the autoload?
Is it on demand? Thanks!
(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.
What is the best way to make autoload incldues?
such as: include_once (DIR_LIB. "interface / components / TinyMce.php"); Thanks a lot for help!
(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 ![]()
|
Welcome Guest, Not a member yet? Register Sign In |