我可以在电子邮件标题中使用php包含吗?
试图做到这一点我可以在电子邮件标题中使用php包含吗?,php,email,Php,Email,试图做到这一点 $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: $sales_rep_name <$sales_rep>' . "\r\n"; mail($to,$subject,$message,$headers); 但它不起作用。有什么想法吗?需要双引号才能在字符串中插入
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: $sales_rep_name <$sales_rep>' . "\r\n";
mail($to,$subject,$message,$headers);
但它不起作用。有什么想法吗?需要双引号才能在字符串中插入变量:
$headers .= "From: $sales_rep_name <$sales_rep>" . "\r\n";
^ ^
$headers.=“发件人:$sales\u rep\u name”。“\r\n”;
^ ^
字符串“not working”不是PHP中的内置错误消息。“not working”是一个无用的诊断。我们的回答也可以是“好吧,也许你支付的字符串不够”。OP:请参阅进一步解释(其他人也一样)。
$headers .= "From: $sales_rep_name <$sales_rep>" . "\r\n";
^ ^