Home >Backend Development >PHP Tutorial > []PHP中用正则替换文本

[]PHP中用正则替换文本

WBOY
WBOYOriginal
2016-06-13 13:13:57990browse

[求助]PHP中用正则替换文本
现在页面中有一段文字如下:
------------------------------
测试文本A
[code=H]aa622ea28638f1e2f9ebc1c845499ed3[/code]
测试文本B
[code=H]D0C93D1FAC0843A993431688BD6AFD10[/code]
测试文本C
[code=H]0F3D2A4C5BCA48F0B9E8E4564DEFB127[/code]
-------------------------------
如上,php中如何用正则找到上面“以[code=H]开头和[/code]结尾”的文本,并替换成另外一段文本。
小弟是php新手,谢谢大侠了。

------解决方案--------------------
另外一段文本 是什么样的?
------解决方案--------------------

PHP code
$s =
                 
              
              
        
            
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