<p class="sougouContent"> <br> 我想在 <br> <a>88-1</a> <br> 的88-1前面加一个字符串怎么写呀? </p> <br> <h2>回复讨论(解决方案)</h2> <p class="sougouAnswer"> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="sycode" name="code">$s = "<a onclick=window.open('a.html')>88-1</a>";echo preg_replace('/(<a[^>]*?>)(.*?)<\/a>/', '${1}test${2}</a>', $s);//输出后看html内容</pre><div class="contentsignin">登入後複製</div></div> </p> <p class="sougouAnswer"> 谢谢大神。膜拜! </p>