Preg替换php字符串的帮助

时间:2015-09-17 04:55:52

标签: preg-replace

$testString = 'this is testing start [youtube=http://www.youtube.com/watch?v=abcd&w=640&h=390] this is last'; 

我想通过以下方式取代:

$testString = 'this is testing start <iframe src="http://www.youtube.com/watch?v=abcd&w=640&h=390"></iframe> this is last';

请帮助!

1 个答案:

答案 0 :(得分:0)

您可以使用strtr function

试试这个:

<div id="parent" style="text-align:center">
    <a href="/personalised-payment-page/" class="btn btn-info btn-lg btn-raised" style="max-width: 300px !important;">CREATE YOURS NOW</a><br>
    <b style="color: #388e3c;">(FREE - LIMITED PERIOD)</b>
</div>