-5
我试图插入HTML和PHP为PHP变量,而是一个语法错误被抛出:插入HTML和PHP到PHP变量
$nestedData[] = $row["titulo_anuncio"];
$nestedData[] = $row["texto_anuncio"];
$nestedData[] = $row["fecha_anuncio"];
$nestedData[] = <<<EOD
<div>
<a id="<?php echo $row['emp_id']; ?>" class="edit-link" href="#" title="Edit">
<img src="edit.png" width="20px" />
</a>
</div>
EOD;
该错误是在最后$ nestedData []变量抛出。
你已经在PHP。阅读PHP手册中的heredoc页面,了解如何输出变量。 http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc(特别是标题为“Example#2 Heredoc string quoting example”的位) – ceejayoz
应该有抛出你一个解析错误 –
谢谢你@ceejayoz – mvasco