I have code structure in which I have class file, template file and controller file. And in every conroller file I have to call atleast 6 include_once(); How to avoid writing include_once() in file again and again for including different class?
Share
Take a look at PHP 5’s autoloading mechanism.
It takes care of including the necessary files when the class is used.
In addition to saving you tons of include statements, only includes actually used in the current context will be loaded.