問題描述
我應該使用 mysqli_real_escape_string
還是應該使用準備好的語句?
Should I use mysqli_real_escape_string
or should I use prepared statements?
我看過一個教程,現在解釋了準備好的語句,但我看到它們和 mysqli_real_escape_string
做同樣的事情,但它使用了更多行
I've seen a tutorial now explaining prepared statements but I've seen them do the same thing as mysqli_real_escape_string
but it uses more lines
準備好的報表有什么好處嗎?您認為最好的方法是什么?
Are there any benefits for prepared statements? What do you think is the best method to use?
推薦答案
準備好的語句.因為無處逃避是一回事.實際上,逃避與任何注射都沒有關系,不應該用于保護.
Prepared statements only. Because nowhere escaping is the same thing. In fact, escaping has absolutely nothing to do with whatever injections, and shouldn't be used for protection.
雖然準備好的語句在適用時提供 100% 的安全性.
While prepared statements offer the 100% security when applicable.
這篇關于我應該使用 mysqli_real_escape_string 還是應該使用準備好的語句?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!