php str_replace替换特殊字符

 替换单引号,双印,正斜杠,反斜杠等等,and,select等等
<?php

$str = 'a\bc"1\'2d4/e/fgh\\\abc\\//a"bandan\'and';
echo $str.'<br>';
$search = array(1, 2, 3, 4, 5, 6,'*','$','\\','/',"'",'"',"and");
echo str_replace($search, '', $str);//abcdefghabcaban
echo '<hr>';

?>

 

posted on 2017-03-25 08:39  防空洞123  阅读(7452)  评论(0编辑  收藏  举报

导航