关于@ 运算符,已经给出了很好的答案,但这里有一些对您或其他人可能有用的信息:
考虑到这段代码:
// This file doesn't exist
if (!@fopen('/tmp/non-existant-file.txt', 'r')) {
var_dump($php_errormsg);
}
// My Apache server doesn't have the right to read this file
if (!@fopen('/tmp/vboxdrv-Module.symvers', 'w')) {
var_dump($php_errormsg);
}
你会得到这个:
string 'fopen(/tmp/non-existant-file.txt) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory' (length=129)
string 'fopen(/tmp/vboxdrv-Module.symvers) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied' (length=122)
所以,真实的、有用的、有意义的、错误信息;-)