找到\ backslash并从字符串php中删除它
问题描述:
I have a problem with replace \ from string
<?php $postlink = str_replace( "\" , '', $postlink); ?>
what's wrong with that line dreamweaver tell me that wrong line
我遇到了来自字符串
&lt的问题 ;?php $ postlink = str_replace(“\”,'',$ postlink); ?&gt;
code> pre>
该行有什么问题Dreamweaver告诉我错误的行 p>
div>
答
\
is a special character you need to use \\
<?php
$postlink = str_replace( "\\" , '', $postlink);
?>
You can also use stripslashes()
for removing slash, why are you str_replace()
? if you have only backslashes than use stripslashes()
.
Example:
echo stripcslashes("it\'s working day!"); //it's working day!