Back

linux - php - 语法中的@ at call function

发布时间: 2023-01-15 06:23:00

refer to :
https://www.geeksforgeeks.org/what-is-the-use-of-the-symbol-in-php/

@是为了防止不报错的。类似ruby中的rescue

例如

<?php
  
// Statement 1, PHP Notice: Undefined variable: hello.
$result= $hello['123'] 
  
// Statement 2
$result= @$hello['123']
?>

上面的代码中,下面的代码不会打印报错信息

Back