PHP
例子1: 把'\'变成'\\'
$str = preg_replace("/\\\\/","\\\\\\",$str);
例子2: 把'/'变成'//'
$str= preg_replace("/\//","//",$str);
PHP
例子1: 把'\'变成'\\'
$str = preg_replace("/\\\\/","\\\\\\",$str);
例子2: 把'/'变成'//'
$str= preg_replace("/\//","//",$str);
转载于:https://www.cnblogs.com/liubingna/p/3283982.html