2017-04-08 64 views
-2

刪除單個backslashe我想從字符串如何從字符串在PHP

$str = "Lionel Messi\'s is a footballer of the year."; 
$str = stripslashes($str); 

刪除單個反斜槓,但它無法正常工作。

+0

我投票關閉因爲這是不可重現的。正如預期的那樣,PHP 5.4產生了「梅西的年度足球先生」和_echo $ str_。 –

回答

0

這很容易做到這一點。

<?php 
    $str = "Hello world\'s"; 
    echo stripslashes($str); 
?> 
0

您可以嘗試

str_replace函數( '/', '',$ STR)

0

你可以試試這個:

echo preg_replace('/\\\\/', '', $string);