Php 替换占位符和回显内容
我有一个内容变量Php 替换占位符和回显内容,php,Php,我有一个内容变量$number['content'],其中有一个占位符,需要替换为$email变量 下面是内容变量中存储的内容。 这将取代正常工作 <?php $content = '<iframe src="url.com&em=<!--email-->&se=51" style="width:900px;height:700px;"></iframe>'; $content = str_replace('<!-- emai
$number['content']
,其中有一个占位符
,需要替换为$email
变量
下面是内容变量中存储的内容。
这将取代正常工作
<?php
$content = '<iframe src="url.com&em=<!--email-->&se=51" style="width:900px;height:700px;"></iframe>';
$content = str_replace('<!-- email -->', $email, $content);
您的另一个问题上可能重复的相同答案将回答此问题。谢谢我做了str_替换(“”,$email,$number['content');它成功了
<?php
$content = '<iframe src="url.com&em=%s&se=51" style="width:900px;height:700px;"></iframe>';
$content = sprintf($content, $email);