Php 如何替换$mail中的多个字符串->;msgHTML
除了以下代码中的Php 如何替换$mail中的多个字符串->;msgHTML,php,Php,除了以下代码中的[email\u here]之外,如何替换name=[name\u 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 hre
[email\u here]
之外,如何替换name=[name\u 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>
你不必在一行中完成所有的工作。使用临时变量,使其更具可读性。第二个参数(参见手册示例#1)也需要是数组。@mario,谢谢你……它起作用了
$email2 = "email.com";
$name = "myname";
$mail->msgHTML(
str_replace(array('[email_here]', $email2,'[name_here],$name'),
file_get_contents('email-content.php')), dirname(__FILE__)
);