Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/262.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP相当于python';s三重引号-如何在PHP中打印大量HTML而不转义_Php_Python_Codeigniter_Heredoc_Language Comparisons - Fatal编程技术网

PHP相当于python';s三重引号-如何在PHP中打印大量HTML而不转义

PHP相当于python';s三重引号-如何在PHP中打印大量HTML而不转义,php,python,codeigniter,heredoc,language-comparisons,Php,Python,Codeigniter,Heredoc,Language Comparisons,可能重复: python中的三重引号转义其中包含的所有引号和换行符。比如说, """ this is all just one string. I can even tell you "I like pi". Notice that the single quotes are escaped - they don't end the string; and the newlines become part of the string """ 有人知道PHP是否有一个与python相当的版

可能重复:

python中的三重引号转义其中包含的所有引号和换行符。比如说,

""" this
is all


just one string. I can even tell you "I like pi".
Notice that the single quotes are escaped - they don't end the string; and the newlines become part of the string
"""
有人知道PHP是否有一个与python相当的版本吗

""" <form><h1>PUT HTML HERE</h1> </form> """
enter code here
“将HTML放在这里”
在这里输入代码
编辑: 对于那些在未来关注这个问题的人,我已经回答了,下面是一个例子:

$heading=“heading Gettizburgz”;
打印您可以使用或nowdocs(见下文)

herdeoc

$bar = <<<EOT
bar
EOT;
$str = <<<'EOD'
Example of string
spanning multiple lines
using nowdoc syntax.
EOD;

$bar=@RobertHarvey,我想你没有回答这个问题,因为标记吞噬了所有的换行符。这根本不是发问者的错。@Markransem:这是一个“一般参考”问题,还是不够模糊,可能会让其他人受益?到目前为止发布的答案似乎相当平凡。@RobertHarvey:我过去(在学习PHP时)也曾搜索过类似的问题。我认为这不是一个坏问题。我认为它在这里有一个位置,对不起,伙计们,看起来你们中的一些人看到了我刚才注意到的东西——在python中,你可以有三个引号,然后把你想要的HTML放在三个引号中,只要你用“.”关闭字符串。我正在寻找一种在PHP中实现这一点的方法,因为我总是这样做:echo“" . $迈瓦尔。"" ; 而在Python中,它类似于:myVar2=“”myVar”“”print myVar2希望对您有所帮助,下次我会尽量说得更清楚一些。:)谢谢你,迈克尔。你会惊讶于我在函数中浪费了多少时间来逃避这些东西。。。。非常感谢你!没问题。很高兴解决了您的问题:)