Hi,
I wrote stuff with file_put_contents() in a try{} catch{} and it worked.

Then I'd like to check what happens when some error occurs so I writeprotected the targetfile. Instead of getting my own message by the catch{} block I got a standard warning in the browser.

Can't I catch those warnings, too?
And why does this function rise a warning when it can't acomplish it's task?


Samplecode:
    try {
        $msg = date ("d.m.Y H:i:s") . 'This should be stored in the file.';
file_put_contents( '/tmp/exceptions.txt', $msg . "\n", FILE_APPEND);
    }
    catch ( Exception $e ) {
        $msg = "Exception " . $e->getCode() . " / " . $e->getMessage();
        echo "<p>$msg</p>";
    }

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to