【问题标题】:PHP: 'syntax error, unexpected T_STRING' with mail()PHP:“语法错误,意外的 T_STRING”与 mail()
【发布时间】:2012-08-10 08:39:19
【问题描述】:

我有一个简单的脚本,只用 PHP 发送邮件:

mail( "$webmaster_email", "RSVP from WC Entry Form",
   "From: $email, \n Name: $firstname $lastname \n 
   Phone Number: $phone \n 
   Address: $postal \n );
header( "Location: $thankyou_page" );

但我收到Parse error: syntax error, unexpected T_STRING

我不确定这是什么谷歌没有给我任何明确的答案

有人知道为什么会这样吗?

【问题讨论】:

    标签: php forms html-email


    【解决方案1】:
    mail( "$webmaster_email", "RSVP from WC Entry Form",
       "From: $email, \n Name: $firstname $lastname \n 
       Phone Number: $phone \n 
       Address: $postal \n ");
    header( "Location: $thankyou_page" );
    

    你只是忘记了'"'。

    【讨论】:

    • 谢谢大家 - 应该很明显
    【解决方案2】:

    修改代码

    mail( "$webmaster_email", "RSVP from WC Entry Form",
       "From: $email, \n Name: $firstname $lastname \n 
       Phone Number: $phone \n 
       Address: $postal \n ");
    header( "Location: $thankyou_page" );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-20
      • 1970-01-01
      • 2017-06-20
      • 2013-04-12
      • 2010-11-20
      • 1970-01-01
      相关资源
      最近更新 更多