开发者

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜