How can I remove escape characters using PHP?

前端 未结 1 744
独厮守ぢ
独厮守ぢ 2021-01-18 18:10

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 esc

相关标签:
1条回答
  • 2021-01-18 19:09

    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";
    

    Which outputs:

    \\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.

    0 讨论(0)
提交回复
热议问题