| Newsgroups |
php.general |
| Message-ID |
<[email protected]> |
On 3/22/10 10:25 AM, Paul M Foster wrote:
> That's the key. You can do anything you want inside __autoload(). If you
> must consult something in the environment, there are a couple of ways to
> do it. First, set a variable in the $_SESSION array, and consult it in
> __autoload(). Second, use a configuration file for your application.
> Have it in a stable place, and read the values out of it as needed.
> Consult these in your __autoload() if you like.
>
> Paul
I'd suggest skipping __autoload() and going straight for
spl_autoload_register(), as it does the same thing but is more flexible
since you can then have multiple autoload callbacks if necessary.
--Larry Garfield