【问题标题】:PHP new lines in CodeIgniter controllerCodeIgniter 控制器中的 PHP 新行
【发布时间】:2013-08-12 01:05:14
【问题描述】:

任何人都可以从 CodeIgniter 控制器脚本中看到以下代码行的错误 - 它是电子邮件脚本的一部分。

“\n”不会在电子邮件中显示为新行 - 只是“\n”原始代码本身:

$this->email->message($_POST['name'] 
        . " \n" . $_POST['email'] . " \n" . $_POST['message']);

它们用双引号括起来,所以我看不出问题出在哪里......

【问题讨论】:

  • 我不认为 \n 在这里解析。尝试使用中断标记
  • 我觉得不错,电子邮件的内容类型是什么?

标签: php codeigniter email error-handling newline


【解决方案1】:

我已经做了你想做的同样的事情(成功):

$msg="
Name: ".$this->input->post('name')."
Email: ".$this->input->post('email')."
Message: ".$this->input->post('message');
$this->email->message($msg);

希望对您有所帮助。有什么问题可以评论。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-03
    相关资源
    最近更新 更多