How to reference a static variable in a HTMLDOC content in PHP
How can I use a
templateize::$subject
in a
$html = <<<HTMLDOC
abc+abc+ab templateize::$subject
HTMLDOC;
in a H开发者_JAVA技巧TMLDOC content?
The docs are here.
The code looks like this:
<del>
$html = <<<HTMLDOC
abc+abc+ab {${templateize::$subject}}
HTMLDOC;
</del>
Actually, that's not quite true. If templateize::$subject == "foo"
, the above will be interpreted as {$foo}
.
I can't seem to find a possibility to achieve, what you want, except from this:
$foo = templateize::$subject;
$html = <<<HTMLDOC
abc+abc+ab $foo
HTMLDOC;
$html = <<<HTMLDOC
abc+abc+ab {$templateize::$subject}
HTMLDOC;
OR
$html = <<<HTMLDOC
abc+abc+ab $templateize::$subject
HTMLDOC;
精彩评论