php中@mysql_connect与mysql_connect有什么区别

 屏蔽错误

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

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

猜你喜欢

转载自blog.csdn.net/liuyuinsdu/article/details/113878807