Re: Auto Class loading

From: Date: Thu, 18 Nov 2004 01:26:00 +0000
Subject: Re: Auto Class loading
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-202367@lists.php.net to get a copy of this message
On Wed, 17 Nov 2004 19:17:13 -0200, Bruno B B Magalhães <brunobbm@rio.com.br> wrote: > Continuing the classes questions... > > I have a class loader called 'load_core_class($class=''), but if $class > equals to all I would like to load all classes in the core directory, > include then AND start then this way: > If you're on PHP-5 you could use the __autoload function, so when a class is used will be automatically locaded. You should declare this function before using any class: function __autoload($classname) { require_once('/path/to/classes/dir/' . $classname . '.inc'); } Regards, Jordi.

« previous php.general (#202367) next »