将HTML和PHP插入PHP变量[重复]

This question already has an answer here:

I am trying to insert HTML and PHP into a PHP variable, but a syntax error is thrown:

    $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;

The error is thrown at the last $nestedData[] variable.

</div>

Try this:

$nestedData[] = $row["titulo_anuncio"];
$nestedData[] = $row["texto_anuncio"];
$nestedData[] = $row["fecha_anuncio"];
$nestedData[] = <<<EOD
<div>
<a id="{$row['emp_id']}" class="edit-link" href="#" title="Edit">
        <img src="edit.png" width="20px" />
        </a>

EOD;

You can't echo $row['emp_id'] within a line defining a string.