简体   繁体   English

将数据输入mysql时为什么会出现斜线?

[英]Why am I getting slashes when inputing data into mysql?

If I input into mysql 如果我输入mysql

htmlspecialchars("test'ed", ENT_QUOTES, 'UTF-8')

its stored as test'ed. 其存储为测试的。

If I use 如果我用

htmlspecialchars( $_POST["txtfirstname"], ENT_QUOTES, 'UTF-8')

its stored as test/'d 其存储为测试/

Whats the deal with the slash when using posted data? 使用已发布的数据时,如何处理斜杠?

Turn off magic quotes, or use stripslashes. 关闭魔术引号,或使用反斜杠。 the slash is being inserted for you. 正在为您插入斜线。

http://php.net/manual/en/function.stripslashes.php http://php.net/manual/zh/function.stripslashes.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM