Home >Backend Development >PHP Tutorial >preg_replace匹配尖括号的问题

preg_replace匹配尖括号的问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-23 13:55:571344browse

 $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;
我是黑色

搞定了,谢谢

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn