Re: example of file_exists() ???

From: Date: Mon, 30 Oct 2000 09:10:56 +0000
Subject: Re: example of file_exists() ???
Groups: php.general 
Request: Send a blank email to php-general+get-22631@lists.php.net to get a copy of this message
No fair! :) That's a good idea. -jeremy brand >Anyway it is late I am going to bed. Good >night. > > Philip > > > >-- >be outside the box. > >On Mon, 30 Oct 2000, jeremy brand wrote: > >> Hi Richard, >> >> Usually, you need to give a path with your function call too: >> >> for example: >> >> if (file_exists('/etc/passwd')) >> print 'Whoo hoo!'; >> >> If your common.php is in your current working directory, then try this: >> >> if (file_exists('./common.php')) >> { >> //do_something like an include... >> include('./common.php'); >> } >> >> Hope this helps, >> -jeremy brand >> >> --- "Richard Creech - DreamRiver.com" <richardc@dreamriver.com> >> > wrote: >> >Hello All, >> >Can someone kindly post an example of using file_exists() ??? >> > >> >I've checked the manual, read some manual notes, tried out a few variations but >> >nada .... >> >This is the offensive code: >> > >> >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' >> > >> >Of course it can't access common.php, it isn't there - that is what I want to >> >test for - the absence of that common.php file! >> > >> >It would be nice if there was just ONE working example included in with the manual for >> >each function... the manual looks clear and concise, but my code doesn't work :( >> > >> >Thank you. >> >Regards, >> > >> >Richard Creech >> >richardc@dreamriver.com Phone: 250.744.3350 Pacific Time Canada >> >Get a free link at http://www.dreamriver.com/phpYellow/ >> >Download phpYellow Pages 2000 - Now shipping Version 1.05 with EasySQL! >> >Add Dynamic Database Content to your Website >> >http://dreamriver.com/software/ >> > >> > >> >-- >> >PHP General Mailing List (http://www.php.net/) >> >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net >> >For additional commands, e-mail: php-general-help@lists.php.net >> >To contact the list administrators, e-mail: php-list-admin@lists.php.net >> >> == >> _______________________________________________________________________ >> GnuPG Fingerprint: 9F5E 95E0 1CC2 E054 84EA 6099 8ACD 9DBA D2C0 5EA9 >> _ http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html >> for more __ >> >> _____________________________________________________________ >> Get Your Own Private, Free E-mail Now! >> your_name@smackdown.com http://www.smackdown.com == _______________________________________________________________________ GnuPG Fingerprint: 9F5E 95E0 1CC2 E054 84EA 6099 8ACD 9DBA D2C0 5EA9 _ http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more __ _____________________________________________________________ Get Your Own Private, Free E-mail Now! your_name@smackdown.com http://www.smackdown.com <spacer> Half.com the hottest site for DVDs, CDs & more! Get $5 off your 1st purchase of $10 or more. http://ads.adflight.com/mach1.asp?a=19061&b=46867&c=3094

« previous php.general (#22631) next »