如何使用 PHP 删除转义字符?
我有以下文本,
$text = "\\vct=140\\Araignée du soir espoir,araignée du matin,espoir du matin."
我想使用 php 删除转义字符。我不想使用 stripslashes,因为它依赖于服务器。
我想删除 '\vct=140' 之前的 '\' 和 '\ ' 在 '\Arai....' 之前 我怎样才能将它们从字符串中删除?
I have the following text
$text = "\\vct=140\\Araignée du soir espoir,araignée du matin,espoir du matin."
I want to remove the escape characters using php..I do not want to use stripslashes since it is server dependent..
I want to remove the '\' before the '\vct=140' and the '\' before '\Arai....'
How can I remove them from the string?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知
stripslashes
可以按照手册工作:输出:
序列
\\
位于 特殊字符的转义序列所以你必须逃避斜线两次。As far as I can tell
stripslashes
works as per the manual:Which outputs:
Sequence
\\
is in list of escape sequences for special characters so you got to escape slashes twice.