我的内容变量$number['content']
中包含占位符<!--email-->
,需要将其替换为$email
变量。
以下是存储在内容变量中的内容。
<iframe src="url.com&em=<!--email-->&se=51" style="width:900px;height:700px;"></iframe>
我需要用变量$email
答案 0 :(得分:0)
这将取代应该工作。
<?php
$content = '<iframe src="url.com&em=<!--email-->&se=51" style="width:900px;height:700px;"></iframe>';
$content = str_replace('<!-- email -->', $email, $content);
如果有可能,我建议使用sprintf()。
<?php
$content = '<iframe src="url.com&em=%s&se=51" style="width:900px;height:700px;"></iframe>';
$content = sprintf($content, $email);