为了账号安全,请及时绑定邮箱和手机立即绑定

如何替换\成/

D:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\www\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\dunling   替换成D:\www\dunling   谢谢

正在回答

1 回答

$pattern = "/\\\+/";

$replacement = '\\';

$str = 'D:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\www\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\dunling';
//$str = stripcslashes($str);
$result = preg_replace($pattern,$replacement,$str);
var_dump($result);

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
鬼斧神工之正则表达式
  • 参与学习       47865    人
  • 解答问题       113    个

以PHP语言为蓝本,介绍正则表达式的基本语法以及他的强大用处

进入课程

如何替换\成/

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信