如何使用PHP删除转义字符? [英] How can I remove escape characters using PHP?
本文介绍了如何使用PHP删除转义字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下文本
$text = "\\vct=140\\Araignée du soir espoir,araignée du matin,espoir du matin."
我想使用php ...删除转义字符。我不想使用stripslashes,因为它是服务器依赖..
I want to remove the escape characters using php..I do not want to use stripslashes since it is server dependent..
我想在'\vct = 140'之前删除'\'和'\Arai ..之前的'\' ..
如何从字符串中删除?
I want to remove the '\' before the '\vct=140' and the '\' before '\Arai....' How can I remove them from the string?
推荐答案
据我所知, $ c> stripslashes 按照手册 的作品:
As far as I can tell stripslashes
works as per the manual:
<?php
$string = '\\\\vct=140\\\\Araignée du soir espoir.';
echo $string, "\n";
echo stripslashes($string), "\n";
哪些输出:
\\vct=140\\Araignée du soir espoir.
\vct=140\Araignée du soir espoir.
序列 \\
在列表中特殊字符的转义序列,所以你必须逃避斜杠两次。
Sequence \\
is in list of escape sequences for special characters so you got to escape slashes twice.
这篇关于如何使用PHP删除转义字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文