0
我正在處理html電子郵件模板,一切正常。我只需要做更多的事情,將用戶名添加到電子郵件$en['user'];
這是可能的,當從一個文件加載HTML內容?或者,我是否必須將html電子郵件tpl代碼內嵌到流程郵件文件中?在處理之前將字符串/ var插入文件
...
$body = file_get_contents('emails/welcome.tpl');
mail($en['email'], $subject, $body, $headers);
編輯:這會是解決方案嗎?在參考下面的@Dagon評論?
$tpl_body = file_get_contents('emails/welcome.tpl');
$body = str_replace("%user%",$en['user'],$tpl_body);
mail($en['email'], $subject, $body, $headers);
str_replace函數,preg_replace函數... – 2011-12-19 19:15:21
@Dagon我做了一個改變我上面的代碼,它會按我發佈的方式工作? – acctman 2011-12-19 23:19:29