addcslashes()函数
1.addcslashes()函数,是在指定的字符前添加反斜杠。
语法:addcslashes(str,chararcters);
2.中参数str是必须的,规定要检查的字符串,而character是可选的,规定受addcslashes()影响的字符或字符范围。
<?php
$str="Hello,my name is John Adams.";
echo $str; //输出:Hello,my name is John Adams.
echo addcslashes($str,'m'); //输出: Hello,\my na\me is John Ada\ms.
echo addcslashes($str,'J'); //输出:Hello,my name is \John Adams ?>