PHP回声没有伪装

Flo*_*ler 1 php echo

我听说有可能在没有伪装每个引用的情况下回显字符串(例如HTML).我记得,它看起来像这样:

<?php
ECHO SOME_NAME 

<div style="background-color: green;">The quotes here doesn't have to be masqueraded</div>

SOME_NAME
?>
Run Code Online (Sandbox Code Playgroud)

但我不知道它究竟是如何起作用的.你能帮助我吗?

格力兹,弗洛里安

Thi*_*ter 7

你可能意味着heredoc语法(读它!它有一些意想不到的东西,比如END标记必须是行上唯一的东西 - 即之前没有缩进或分号后的注释/代码):

echo <<<END
your stuff with " and ' here
END;
Run Code Online (Sandbox Code Playgroud)

如果您可以使用PHP 5.3并且不希望在字符串中替换变量,请使用oewdoc语法:

echo <<<'END'
your stuff with " and ' and $not_parsed here
END;
Run Code Online (Sandbox Code Playgroud)