Heredoc 通常用于较长的字符串,甚至可能是多个想法,您可能希望将其分段为单独的行。
正如tuxradar所说:“为了让人们可以轻松地在 PHP 中编写大量文本,而不需要不断地逃避事情,因此开发了 heredoc 语法”
<?php
$mystring = <<<EOT
This is some PHP text.
It is completely free
I can use "double quotes"
and 'single quotes',
plus $variables too, which will
be properly converted to their values,
you can even type EOT, as long as it
is not alone on a line, like this:
EOT;
?>
在您的情况下,简单地回显您的字符串会更有意义。
$message = '<p style="font-size: 9px; font-family: Verdana, Helvetica; width: 100%; text-align:left;">Clcik to remove <a href="http://www.mysite.com/remove.php?email=' $email '">clicking here.</a></p>';
echo $message;