php 在函数前面加个@的作用

php 在函数前面加个@的作用


@是PHP提供的错误信息屏蔽的专用符号。
比如在一个函数前使用@
@mysql_query 不会出现Warning,
而原来mysql_query 在遇到错误时会在页面上访提示Warning。

//更新、删除、添加记录数
function uidRst($sql){
if($this->conn == ''){
$this->init_conn();
}
@mysql_query($sql);
$this->rowsNum = @mysql_affected_rows();
if(mysql_errno() == 0){
return $this->rowsNum;
}else{
//return '';
return $this->msg_error();//TonnyLi Debug
}
}
发表评论 / Comment

提示:本文章评论功能已关闭