PHP functions and @functions

前端 未结 5 1620
南笙
南笙 2020-12-14 16:56

Basically, I\'ve seen people using @ before their function calls, not for every function, but for some kind of extension functions like file_get_contents(

相关标签:
5条回答
  • 2020-12-14 17:14

    The @ symbol in front of a function prevents errors from being displayed when the function is called.

    0 讨论(0)
  • 2020-12-14 17:20

    @function doesn't show any error messages on its HTML output, while a regular function call will.

    0 讨论(0)
  • 2020-12-14 17:23

    It's the PHP's error control operator used to suppress any error generated by the function call.

    0 讨论(0)
  • 2020-12-14 17:29

    @ is an error control operator. Basically it's suppressing errors.

    0 讨论(0)
  • 2020-12-14 17:37

    I have similar doubt about @ used in front of functions. To avoid this I made some verification before the function call. My example is:

    if ( is_file($filename) ) $timestamp = filemtime( $filename );

    0 讨论(0)
提交回复
热议问题