RE: [PHP] example of file_exists() ???

From: Date: Mon, 30 Oct 2000 09:42:05 +0000
Subject: RE: [PHP] example of file_exists() ???
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-22638@lists.php.net to get a copy of this message
Hello Richard, > if (file_exists("common.php")) { > require("common.php"); > $hostname = DBSERVERHOST; > //bring in the rest of the CONSTANTS, do an autologin > // more snipped code > }else{ > // do a manual login instead without common.php > } > ... and so on ... > > This is the error it gives: > Warning: Unable to access common.php > Fatal error: Failed opening required 'common.php' use 'include' instead of 'require' and whole thing should work. You can't require in a conditional. Cheers, Matthias

« previous php.general (#22638) next »