首页 >后端开发 >php教程 >preg_replace匹配尖括号的问题

preg_replace匹配尖括号的问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原创
2016-06-23 13:55:571333浏览

 $wenzis="我是<图片1>";$wenzi="黑色"; $tihuanzhi   = "<图片1>"; //要替换的值   $wenzis = preg_replace($tihuanzi, $wenzi, $wenzis,1);

替换结果是 "我是",替换结果没把尖括号去掉,请教怎么把尖括号也替换掉


回复讨论(解决方案)

$wenzis = "我是<图片1>";$wenzi = "黑色";$tihuanzhi   = "/<图片1>/"; //要替换的值$wenzis = preg_replace($tihuanzhi, $wenzi, $wenzis,1);echo $wenzis;
我是黑色

搞定了,谢谢

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn