我有一个包含'\'的字符串,但是当我用空格替换字符串时 它显示错误。
$emailbody = str_replace('\','',$emailbody);
谢谢大家
答案 0 :(得分:1)
你走了:
$emailbody = str_replace('\\', '', $emailbody);
答案 1 :(得分:1)
请尝试stripslashes
$emailbody = "hello \ its a testing\ string";
echo $emailbody = stripslashes($emailbody);
注意 stripslashes
仅删除backslashes
无法转发
或
echo $emailbody = str_replace("\\","",$emailbody);
输出
hello its a testing string
答案 2 :(得分:0)
逃避反斜杠...... \\
答案 3 :(得分:0)
试试这个,
使用\/
$emailbody = str_replace('\/','',$emailbody);