Php 为什么换行符转义序列没有转换成换行符?
我正在尝试使用codeigniter发送一封电子邮件,希望邮件跨越几行Php 为什么换行符转义序列没有转换成换行符?,php,email,codeigniter,escaping,Php,Email,Codeigniter,Escaping,我正在尝试使用codeigniter发送一封电子邮件,希望邮件跨越几行 $address = $this->input->post('email'); $subject = 'Please complete your registration'; $message = 'Thanks for registering! \n To complete your registration, please click on (or copy and paste in your browser
$address = $this->input->post('email');
$subject = 'Please complete your registration';
$message = 'Thanks for registering! \n To complete your registration, please click on (or copy and paste in your browser) the following link: ' . base_url(). "users/confirmRegistration/" . $confirmation_code; //note the '\n' after thanks for registering
$this->load->library('email');
$this->email->from('me@mysite.com', 'myname');
$this->email->to($address);
$this->email->subject($subject);
$this->email->message($message);
$this->email->send();
我希望邮件在“谢谢注册”之后会有一个断行,但我收到的却是
谢谢注册!n完成您的注册(等…)
我已尝试使用\r\n,但结果几乎相同:
谢谢注册!完成(等)。就像应用了一个stripslash函数
有什么想法吗?PHP不会在单引号内解析像
\n
这样的转义序列
您需要用双引号将消息字符串括起来。您需要用这种格式键入正文。 它很好用。 拉胡尔 $body='亲爱的'$行->fname。“”$行->名称。“,” “.”您在我们的帐户已暂时禁用。“” ' . '我们的主持人关系团队将很快与您联系。” ' . '您也可以通过以下方式与我们联系:info@ggg.com' . ' ' . '热烈的问候 ' . ' 团队",