Rusty.Metal Posted April 3, 2003 Share Posted April 3, 2003 How can i make it so when like i can include a file but if the file returns a error it dosent include insted it echos a some text... Link to comment Share on other sites More sharing options...
0 Rusty.Metal Posted April 4, 2003 Author Share Posted April 4, 2003 some one Link to comment Share on other sites More sharing options...
0 Sir CoRN Posted April 4, 2003 Share Posted April 4, 2003 umm include('file') || die("Couldnt load file ! Sorry "); i think would work. Link to comment Share on other sites More sharing options...
0 [pioneer] Posted April 6, 2003 Share Posted April 6, 2003 <? $file = "foo.txt"; include("$file") or die("foo file is not there!"); ?> Link to comment Share on other sites More sharing options...
0 Sir CoRN Posted April 6, 2003 Share Posted April 6, 2003 or if you want it to continue to load, but not show the errors... $file='/path/to/file'; include($file) || echo "Couldn't load $file ! Sorry :("; Link to comment Share on other sites More sharing options...
0 mr_daemon Posted April 8, 2003 Share Posted April 8, 2003 I you don't want to continue loading you can use require() instead of include() EDIT: Wait... WHAT scripting language? I assumed it was PHP... Link to comment Share on other sites More sharing options...
0 mikey Posted April 9, 2003 Share Posted April 9, 2003 $file = "/path/to/file"; if(fileexists($file)){ include $file; }else{ echo "the file could not be included - it does not exist"; } That what you mean? Link to comment Share on other sites More sharing options...
Question
Rusty.Metal
How can i make it so when like i can include a file but if the file returns a error it dosent include insted it echos a some text...
Link to comment
Share on other sites
6 answers to this question
Recommended Posts