try catch error


Posted on 16th Feb 2014 07:03 pm by admin

I have been trying try catch but, I can't get it to work. The code opens a non existing file called "a"

Code: private function fileOpenMethod($filePath, $numberOfLines,$header,$replaceHeader){
try{
$file = file( $filePath);
}catch(file $e){
$e= "the flie path does not work"; //. $e->getMessage();
}

return $e;
}
I am getting an error message on the page but not the one that am trying to generate
Code: Warning: file(a) [function.file]: failed to open stream: No such file or directory in /home/public_html/_Doc/StripFileClass.php on line 15

I am sure it is simple but I am new to try and catch and it is a learning curve blah blah blah.
Can anyone see what I am doing wrong =)

No comments posted yet

Your Answer:

Login to answer
320 Like 17 Dislike
Previous forums Next forums
Other forums

AUTONUMBER PROBLEM
Hello Everyone,

My name is Jones and i am new to this forum and to oracle. I am using ora

Problems generating word documents on server side for security reasons
I have a problem with word documentation generation when generating a word document (docx) with PHP.

IP Logger for Voting Script
Can anybody help me place an IP logger into my voting script?
I know that maybe it is not as secu

Typedef struct vs just struct
Anyone know the rationale for using typedef for structs when a struct is itself a typedef? I have s

Simple program to copy files between two computers over the web
I use logmein free and often need to move files between my two computers. Generally, I move the file

Run function every 5 mins ??
I have a function PostMessage()

How can I run it every 5 mins ??

Cloud Computing?
Hello,

I was wondering if anyone could help explain this term to me. I'm starting to hear it

serializing objects - loses methods - the point being?
Hi

I know that serializing an object will lose the methods. But whats the point in that? What

Converting from one format to another
"I have got a date in DD/MM/YYYY but I need it in MM-DD-YYYY. Help!"

Do While statement
hi guys,

This may sound trivial but im new to php and as part of an assignmenti have to const

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash