Re: __autoload alternative

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 22, 2008 at 2:54 AM, Shelley <myphplist@xxxxxxxxx> 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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux