doutang1946 2018-01-24 17:33
浏览 75
已采纳

将$ _POST变量分配给PHP Mailer()参数

How can one assign $_POST variables to the PHP mailer() 'From:' header parameter?

Here's what I tried:

$toEmail="email@example.com";
$formSubject=$_POST["esubject"];
$formComment=$_POST["comment"];
$header= 'From: $_POST["eaddress"]';

mail($toEmail, $formSubject, $formComment, $header)) {

The subject and comments are working correctly, but the From: turns the variable into a string.

  • 写回答

1条回答 默认 最新

  • doubaoxue5788 2018-01-24 17:35
    关注
    $header= 'From:' . $_POST["eaddress"];
    

    In your code, $_POST["eaddress"] was in a single quote, it would not be evaluated.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

    报告相同问题?

    悬赏问题

    • ¥30 计算机网络子网划分路由模拟操作
    • ¥15 MATLAB的画图问题
    • ¥15 c语言用fopen_s成功打开文件之后闪退
    • ¥20 用C++完成,并且运用数组
    • ¥30 求解电力系统潮流计算结果不收敛问题
    • ¥15 某易易盾点选data解析逆向
    • ¥15 系统崩溃,关于订单的处理
    • ¥15 datax-web连接hive为数据源时发生报错,如何解决?
    • ¥15 plink在进行gwas分析时总读取不到表型
    • ¥20 数据结构与c语言的实践内容