当前位置: 代码迷 >> PHP >> heredoc 不能用于循环中?该如何处理
  详细解决方案

heredoc 不能用于循环中?该如何处理

热度:245   发布时间:2016-04-29 01:20:03.0
heredoc 不能用于循环中?
PHP code
$array = array(1,2,3,4);foreach($array AS $i){    echo <<<HTML    $i    HTML;}

出错 Parse error: syntax error, unexpected $end
while for 都会有问题

------解决方案--------------------
HTML;
结束的标记要顶格!