问题描述
我没有使用PHP连接到数据库的问题,但是在我测试的一些脚本中,我已经看到了一个小的差别在connect命令。
I have no problem connecting to a database using PHP however in some scripts I have tested, I have seen a small difference in the connect command.
@mysql_connect
与 mysql_connect之间有什么区别
?
我在编写自己的脚本时从未使用过 @
符号,所以只是想知道它是否有用
I have never used the @
symbol when writing my own script so was just wondering if it served a purpose.
提前感谢
推荐答案
@
符号在函数前面沉默它。意思是,即使执行失败,也不会得到任何类型的错误信息。所以我建议:不要使用它
The @
symbol in front of a function silences it. Meaning, you won't get any types of error messages when executing it, even if it fails. So I suggest: don't use it
另外,作为@AlexanderLarikov说,不要使用 mysql_ *
,社区已开始对该功能进行。
In addition as @AlexanderLarikov said, don't use mysql_*
anymore, the community has started to depreciate that function.
这篇关于@mysql_connect和mysql_connect的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!