Re: Re: Trouble with include/require

From: Date: Sat, 17 Jul 2004 01:44:59 +0000
Subject: Re: Re: Trouble with include/require
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-190797@lists.php.net to get a copy of this message
* Thus wrote Jason Barnett: > >That will try and find a file in these locations in order: > > /var/www/html/projects/include/db.inc > > ./db.inc > > /php/includes/db.inc > > > >And will use the first one found. > > > >I would not suggest using ini_set() inside you're scripts to > >adjust your paths. > > > > > > > >Curt > > Hey Curt, why do you suggest we don't use ini_set to adjust paths? I'm > using it as part of my library autoloader - it may not be as efficient > as changing the path directly but it seems to work well. The main reason I dont suggest it is that it is really unneccessary code to have inside ones application. Although your code is very well designed and efficient, If i strip out all the code that calculates and sets the include path, and plop the file in my include_path, everything will work just fine. The only time I'll use ini_set() is when debugging something, I'll never use it in a production environment. > ... > if (!class_exists($class)) { btw, you might want use class_exists($class, false), class_exists() will try to use __autoload() by default if the class wasn't defined, causing some wierd side effects. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid!

« previous php.general (#190797) next »