如何在$ mail中替换多个字符串 - > msgHTML

时间:2015-06-14 14:21:02

标签: php

如何在以下代码中替换name=[name_here]以外的[email_here]

PHP

$mail ->msgHTML(str_replace('[email_here]', $email2, file_get_contents('email-content.php')), dirname(__FILE__));

HTML

<p>
  Click on the following link to reset your password.
  <a href="https://www.sample-site.com/reset_password.php?email=[email_here]&&name=[name_here]">
    Reset Password
  </a>.
</p>

我尝试了以下操作,但它没有发送电子邮件并显示无法发送正文错误。

$email2 = "email.com";
$name = "myname";

$mail->msgHTML(
  str_replace(array('[email_here]', $email2,'[name_here],$name'),   
  file_get_contents('email-content.php')), dirname(__FILE__)
);

0 个答案:

没有答案