在函数前加@有什么作用?我在一些脚本中看到过这个
例子:
$connect = @mysql_connect('localhost', 'root', 'password');
instead of
$connect = mysql_connect('localhost', 'root', 'password');
最佳答案
它抑制了函数内部可能发生的任何错误。 Documentation here .
考虑到所有因素,不推荐这样做,因为它会导致一些偷偷摸摸的错误。
关于php - 为什么 @before 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1112733/