我正在尝试将动态内容添加到 HTML 以创建动态电子邮件模板。
所以在我的 HTML 中我有
$html = '<b>Its a html {name} content email {email} here</b>';
我想在我的 HTML 中替换 {name} 和 {email} 的值,这样
$arraydata = ["name"=>"Allan","email"=>"al@al.com"];
那么我该如何继续,以便附加到 HTML 正文的最终 HTML 是
'<b>Its a html Allan content email al@al.com here'
我努力了
$newHtml = "";
foreach ($keyvals as $key=>$val){
//itereate through html file and replace keys with values
//am stuck on how to replace all keys and create the above.
//the keys above can be many
}
return $newHtml;