PHP functions and @functions
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(), mysql_connect() and so on.
And yes, the question is: For what purpose are there these @s before function calls?
Or in other words, what is th开发者_运维问答e difference between @file_get_contents() and file_get_contents()?
@ is an error control operator. Basically it's suppressing errors.
It's the PHP's error control operator used to suppress any error generated by the function call.
The @ symbol in front of a function prevents errors from being displayed when the function is called.
@function doesn't show any error messages on its HTML output, while a regular function call will.
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 );
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论