我有一个像这样的普通段落:
<p>Hey there, I'm a normal paragraph. generated by a Wordpress blog</p>
我想改变:
<p> with <h2> and </p> with </h2>
我用了str_replace();
$paragraph = array("<p>", "</p>");
$heading2 = array("<h2>","</h2>");
$first_sentence = str_replace($paragraph, $heading2, $first_sentence);
它应该可以工作,但我明白了:
<h2>Hey there, I'm a normal paragraph. generated by a Wordpress blog<p>/p></p>
任何想法为什么?