Function try_fopen
Safely opens a PHP stream resource using a filename.
When fopen fails, PHP normally raises a warning. This function adds an error handler that checks for errors and throws an exception instead.
string |
$filename |
File to open |
string |
$mode |
Mode used to open the file |
resource
|
resource |
RuntimeException
|
if the file cannot be opened |