PHP在EOT中插入变量

I want to insert a variable inside the EOT but is not working (I am new to php, maybe that's why). This code is part of a script, when I echo $username alone it shows the real name, but when I put it inside EOT is displaying plain text not the real name..

What am I doing wrong?

$username=getUsername($ID);

echo <<<'EOT'

Some HTML code goes here

Hello $username, welcome back!

Some HTML code goes here

EOT;

You must leave out the single quotes here:

echo <<<'EOT'

This denotes the 'nowdoc' variant, which doesn't interpolate variables.

But you need the original "heredoc" syntax without quotes:

echo <<<EOT
$variable = 'text';
echo <<<EOT
Some {$variable} here
EOT;