0
我有這個字符串是從一個PHP字符串出來的,我如何從中刪除這個字符'\'。如何從字符串中刪除重複反斜槓
'ewuououowe',\'post\',\'page\',\'attachment\',\'portfolio'
我曾嘗試
str_replace("\", "", $string);
但它打破了,因爲人物造型
我有這個字符串是從一個PHP字符串出來的,我如何從中刪除這個字符'\'。如何從字符串中刪除重複反斜槓
'ewuououowe',\'post\',\'page\',\'attachment\',\'portfolio'
我曾嘗試
str_replace("\", "", $string);
但它打破了,因爲人物造型
如果你想一個\
字符添加到字符串,你要逃避它的,與\
- 所以你只寫了兩遍:\\
這會導致下面的替換代碼
str_replace("\\'", "'", $string);
'str_replace(「\\'」,「」,$ string);' –
完美,非常感謝Avinash Raj – user1951739