我正在编写控制器方法的代码,我需要用它来发送电子邮件.我正在尝试使用heredoc语法填写电子邮件正文,但是,结尾标记似乎没有被识别.
$this->email = new Email();
$this->email->from = 'Automated Email';
$this->email->to = 'me@myemail.com';
$this->email->subject = 'A new user has registered';
$this->email->body = <<<EOF
Hello, a new user has registered.
EOF;
$this->email->send();
Run Code Online (Sandbox Code Playgroud)
从打开<<< EOF(直到文件末尾)的所有内容都显示为引号.
任何人都可以看到为什么这不起作用?
任何建议表示赞赏
谢谢.