-1

次のようなテキスト文字列がある場合:

In the beginning<WH7225> God<WH430> created<WH1254><WH853> the heaven<WH8064> and<WH853> the earth<WH776>.

タグ <> を H とそれに続く番号を含むリンクに置き換えたいのですが、PHP でこれを行うにはどうすればよいですか?

4

3 に答える 3

0

この例では:

$string = preg_replace('/<(WH[^>]+)>/', '<a href="mysite.php?code=$1">$1</a>', $string);
于 2013-10-23T21:30:10.210 に答える