如何在PHP字符串中使用撇号? [英] How to have apostrophes in PHP string?
本文介绍了如何在PHP字符串中使用撇号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
部分我的 PHP
代码包括构建一个 URL
字符串,如下所示:
Part of my PHP
code includes the construction of a URL
string as follows:
$msg = $_REQUEST["msg"];
$content = 'action=sendmsg'.
'&user='.rawurlencode($username).
'&password='.rawurlencode($password).
'&to='.rawurlencode($destination).
'&text='.rawurlencode($msg);
当 $ msg
恰好包含一个撇号,它被发送为\
。
When $msg
happens to contain an apostrophe, it get sent as "\'"
.
我需要做什么才能确保反斜杠没有插入 PHP
?
What do I need to do to make sure the backslash is not inserted by PHP
?
推荐答案
你可能想查看striplashes: http://php.net/manual/en/function.stripslashes.php
You probably want to check out stripslashes: http://php.net/manual/en/function.stripslashes.php
这篇关于如何在PHP字符串中使用撇号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文