php 如何隐藏错误消息
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2471471/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to hide an error message
提问by Simon
I want to hide all mysql error messages without using mysql_error().
Are there any solutions?
我想隐藏所有 mysql 错误消息而不使用mysql_error(). 有什么解决办法吗?
回答by Marek Karbarz
Put @in front of your mysql_querycall (@mysql_query('some query');) to suppress the error messages.
放在@您的mysql_query电话 ( @mysql_query('some query');)前面以抑制错误消息。
回答by markcial
First line of code before any function in your php script
php 脚本中任何函数之前的第一行代码
error_reporting(0);
回答by khaldonno
Yes you can add @before all mysql queries.
是的,您可以@在所有 mysql 查询之前添加。
example:
例子:
$result = @mysql_db_query ("database","SELECT * FROM agents WHERE ID = '$id'");
$result = @mysql_db_query ("database","SELECT * FROM agents WHERE ID = '$id'");

