Re: __autoload alternative
| From: | Nathan Nobbe | Date: | Mon, 22 Sep 2008 15:49:39 +0000 |
| Subject: | Re: __autoload alternative | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-280697@lists.php.net to get a copy of this message | ||
On Mon, Sep 22, 2008 at 2:54 AM, Shelley <myphplist@gmail.com> wrote:
> Hi all,
>
> Is there any way to auto load a class without using __autoload() function?
>
> As I want to load some classes under different paths, and that caused
> redeclare of __autoload function.
a lot of people / frameworks, etc. define their own class loading mechanism
in userspace. heres a simple example,
function _autoload($class) {
include(STD_CLASS_PATH . "/$class.php");
if(!class_exists($class)) {
trigger_error("unable to load class $class.", E_USER_NOTICE);
return false;
} else
return true;
}
-nathan