views:

45

answers:

2

I'm using methods from a PHP class all over my code and I don't want to do "require_once" in every file I'm using that class. Is there a way to include the class in a single file, and then access it from everywhere in the code?

Thanks!

+4  A: 

here ya go http://php.net/manual/en/language.oop5.autoload.php

I don't know how helpful it is to replace a single require_once statement in each file with an autoload function.
Dana the Sane
This is where the SPL autoloader comes in handy ;)
DrColossos
A: 

You could potentially use the auto_prepend_file directive (http://php.net/manual/en/ini.core.php), which you should be able to set via .htaccess if you have no other method of doing so.

Cags