替换 Heredoc 语法

Replacement of the Heredoc syntax

    foreach($array["$new"]['features'] as $key => $feature) :
      $features .= <<< ____EOT
        <li> $feature </li>
____EOT;
    endforeach;

目前,我使用的是 heredoc 语法,但这有其缺点。是否有任何其他 PHP 方法可以使用 Heredoc 语法完成相同的 w/o?

只需使用字符串即可。

$features .= "<li> $feature </li>";

Heredoc 的优点是您不必担心在值中转义引号,因此它对于 HTML.

的长块非常有用