Re: Re: class_is_loadable?

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

 



On Sun, Jul 6, 2008 at 6:06 AM, Fabrice VIGNALS <fabrice@xxxxxxxxxxx> wrote:
> Hi,
>
> The problem is not the autoload but the implementation of such function.
> class_is_loadable mean, "hey php look at my class somewhere in my files".
> PHP should inspect some files, in some directories and list classes.
> Which files, which extensions files, in which directories ? ...
> In my mind you must replan your autoload, for exemple make a link beetween
> classes and files name, ie : if file_exists( A.class.php ) include_once(
> B.class.php) else include_once( A.class.php );
> Check the factory method at Zend site, that explain how to work with class
> method, without to know the exact name of class (ex : load an specific class
> depending of the database available)
>


file_exist isn't going to help you if the file is in the include path
somewhere else.  I routinely use the include path to have my shared
code base across multiple sites without duplicated files.  You'd end
up writing some horrible fopen with the use include path flag to test
this.

var_dump(file_exists('PEAR.php')); <- false
var_dump(fopen('PEAR.php', 'r', true)); <- resource if exists

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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