PHP handle "Failed opening ... for inclusion" error
I have a PHP script that triggers some "Failed opening ... for inclusion" fatal errors 开发者_高级运维while using an external library.
Those errors are completely irrelevant and I would like to be able to handle them (doing basically nothing about those) to avoid errors to be raised.
How can I achieve that in PHP?
Thanks,
DaNIf you absolutely want to hide the errors you can take a look at PHP's Error Control Operators. There's usually a reason for errors and/or warnings so it might be better to figure out what's causing these instead of just masking them.
You can suppress errors from individual statements by preceding it with the @
operator. For instance:
@require_once('somefile.php');
精彩评论