[英]How to str_replace \ symbol in php
我有一個包含'\\'的字符串,但是當我用空白替換該字符串時,它顯示錯誤。
$emailbody = str_replace('\','',$emailbody);
謝謝你們
干得好:
$emailbody = str_replace('\\', '', $emailbody);
嘗試stripslashes
此
$emailbody = "hello \ its a testing\ string";
echo $emailbody = stripslashes($emailbody);
需要注意的是stripslashes
只刪除backslashes
不轉發
要么
echo $emailbody = str_replace("\\","",$emailbody);
輸出量
hello its a testing string
轉義反斜杠,以便... \\\\
試試這個,使用\\/
$emailbody = str_replace('\/','',$emailbody);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.