我有一个这样的字符串:替换了preg_replace(PHP)两个标记之间的内容
(link)there is link1(/link), (link)there is link2(/link)
现在我想设置,它看起来像这样的链接:
<a href='there is link1'>there is link1</a>, <a href='there is link2'>there is link2</a>
我用preg_replace尝试过,但结果是错误(Unknown modifier 'l'
)
preg_replace("/\(link\).*?\(/link\)/U", "<a href='$1'>$1</a>", $return);
你需要躲避斜杠(ES) –
但我逃过了斜线以 “\” 或? – Name
什么是标题! –