如何检索“转义”来自db的字符串? [英] How do I retrieve "escaped" strings from db?
本文介绍了如何检索“转义”来自db的字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
mysql_real_escape_string($ _ POST ['position']);
如何删除:\在搜索他们?
所以我不会最终得到:\Piza\
这个足够的安全性还是应该做别的? / p>
谢谢
解决方案
使用 stripslashes()
以摆脱转义字符。
转义是非常好的。如果值为整数,我建议您这样做:
$ value =(int)$ _POST [ 'some_int_field'];
这将确保你总是得到一个整数值。
I'm doing this to all strings before inserting them:
mysql_real_escape_string($_POST['position']);
How do I remove the: \ after retriving them?
So I don't end up with: \"Piza\"
Also is this enough security or should I do something else?
Thanks
解决方案
use stripslashes()
to get rid of the escape character.
Escaping is great. In case the value is going to be integer , I would suggest you do it like:
$value = (int) $_POST['some_int_field'];
This would make sure you always end up with an integer value.
这篇关于如何检索“转义”来自db的字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文