PHP别名@函数 [英] PHP alias @ function

查看:82
本文介绍了PHP别名@函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是PHP的新手,我很困惑看到一些示例调用带有@前缀的函数,例如@mysql_ping().

I'm new to PHP and I'm confused seeing some examples calling a function with a @ prefix like @mysql_ping().

它是做什么用的?谷歌搜索/搜索并没有多大帮助,因为@会被丢弃并且'alias'关键字不够好.

What is it for? Googling / searching is not much of a help since @ gets discarded and 'alias' is not good enough keyword.

推荐答案

@禁止显示错误,警告和通知.

@ suppresses errors, warnings and notices.

如果通过自定义错误处理程序或适当检查$ php_errormsg变量,以便您可以正确处理错误.

You can use it for good purpose if you complement it with a custom error handler or with due check of $php_errormsg variable so you can handle errors properly.

根据我的经验,这种正确用法很少见,反而以不好的方式被大量使用,只是隐藏错误而不对错误采取行动.

In my experience, this proper usage is not seen very much and is instead used a lot in the bad way, just to hide errors without acting on them.

更多信息,请访问 http://www.php.net/manual/zh-CN/language.operators.errorcontrol.php

这篇关于PHP别名@函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆