问题描述
当回显 mysqli_real_escape_string($ db,mysqli_real_escape_string($ db,''));
其中一个将是输出:
1. \
2. \\\
?
是否一个安全的方法来检查一个字符串是否已被转义?
不幸的是,目前我无法测试,因为我无法访问MySQL 24小时。
输出是 \\\
(你的第二个例子) p>
我不认为你可以确定一个字符串是否已经被转义,你应该按照你只能调用 mysqli_real_escape_string()
一次。
I'm using mysqli.
When I echo mysqli_real_escape_string($db,mysqli_real_escape_string($db,'"'));
which one of those will be the output:1. \"
2. \\\"
?
Is there a safe way to check whether a string has been already escaped?
Unfortunately, I cannot test at present as I cannot access MySQL for 24 hours.
The output is \\\"
(your second example).
I don't think you can reliably say whether a string has already been escaped or not, you should organize your code in a way that you only can call mysqli_real_escape_string()
once.
这篇关于PHP当字符串是mysqli_real_escape_string的两倍时会发生什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!