实际上我有使用str_replace的问题,我把我的例子:
<?php
$chars_1=array('\',"/","&","¬","~","-","_");
$chars_2=array("","","","","","","");
$result=str_replace($chars_1,$chars_2,$text);
?>
问题是它在数组中放置字符\,其余我没有问题,但如果我把或使用\更改其他字符我有问题,我怎么可以替换\并在数组中使用在这种情况下替换为什么,如果使用此替换为\ mini脚本给我错误,如果没有使用替换\所有确定
谢谢!
答案 0 :(得分:1)
你必须使用双斜线来逃避斜线:
$chars_1 = array('\\',"/","&","¬","~","-","_");