PHP初记(1) - @函数名的作用

WBOY
Release: 2016-06-13 11:01:37
Original
824 people have browsed it

PHP小记(1) - @函数名的作用

PHP中调用函数(我个人觉得用“函数”比用“方法”要适合些)的时候,在函数名前面加@,那么当执行函数出错时,不会显示出错信息


例如:

function foo($n) {    $result = 1/$n;    return $result;}echo @foo(0); // 函数中会产生除 0 错误,但加上 @ 后并不显示该错误。echo "end"; // 继续输出 end
Copy after login

注意仔细看代码中的注释就会完全明白了。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template