php中@mysql_connect与mysql_connect有什么区别 php中@mysql_connect与mysql_connect有什么区别

屏蔽错误
如果有错的话,会把语句都显示出来。
加@就不显示
$link=@mysql_connect('localhost','root','123') or die ("数据库连接失败");

这样写最好
如果失败(or die )显示 “数据库连接失败” 字样

屏蔽错误
如果有错的话,会把语句都显示出来。
加@就不显示
$link=@mysql_connect('localhost','root','123') or die ("数据库连接失败");

这样写最好
如果失败(or die )显示 “数据库连接失败” 字样

猜你喜欢

转载自www.cnblogs.com/hnqyliu/p/10353854.html