PHP支持一个错误控制运算符:at符号(@)。当添加在PHP中表达式之前时,任何错误消息都会被忽略。
如果你有一个自定义的错误处理函数set_error_handler()那它仍会被调用,但这个自定义错误处理程序可以(也应该)调用error_reporting(),当出发的错误之前有@符号,它将返回0。
如果track_errors功能启用时,任何错误消息将被保存在变量php_errormsg中。这个变量将对每个错误被覆盖,所以如果你想使用它要尽早检查。
原文:
PHP supports one error control operator: the at sign (@). When prepended to an expression in PHP, any error messages that might be generated by that expression will be ignored.
If you have set a custom error handler function with set_error_handler() then it will still get called, but this custom error handler can (and should) call error_reporting() which will return 0 when the call that triggered the error was preceded by an @.
If the track_errors feature is enabled, any error message generated by the expression will be saved in the variable $php_errormsg. This variable will be overwritten on each error, so check early if you want to use it.