|
-
Apr 13th, 2002, 10:33 PM
#1
Thread Starter
Stuck in the 80s
File()
When getting a file's contents, I do the following:
Code:
$info = file('cat' . trim($id) . '.txt') || viewall();
However, if the file doesn't exist, it still shows the error message before running viewall(); How can I make it now show the error message?
-
Apr 14th, 2002, 07:20 AM
#2
PHP Code:
if (is_file($filename)) {
$info = file('cat' . trim($id) . '.txt') || viewall();
} else {
echo "Error!";
}
HTH
-
Apr 14th, 2002, 09:58 AM
#3
Fanatic Member
or substitute is_file with file_exists()
-Matt
-
Apr 14th, 2002, 12:04 PM
#4
Thread Starter
Stuck in the 80s
-
Apr 14th, 2002, 03:18 PM
#5
s'ok.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|