首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >PHP相当于python的三重引号-如何在PHP中打印大量/大量HTML而不进行转义

PHP相当于python的三重引号-如何在PHP中打印大量/大量HTML而不进行转义
EN

Stack Overflow用户
提问于 2012-12-18 06:49:06
回答 1查看 8.5K关注 0票数 9

可能重复:

php string escaping like python’s “”“ ”“”?

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

编辑:对于将来关注这个问题的人,我已经回答了它,下面是一个例子:

$heading = "Heading Gettizburgz"; print <<< END <p><h1>$heading</h1> "in quotes" 'in single' Four score and seven years ago<br/> our fathers set onto this continent<br/> (and so on ...)<br/> </p> END;

印刷品:Heading Gettizburgz "in quotes" 'in single' Four score and seven years ago our fathers set onto this continent (and so on ...)

注意一件重要的事情,你必须确保最后一个END在你代码的最左边(第一列),前面没有任何空格。

来源:http://alvinalexander.com/blog/post/php/php-here-document-heredoc-syntax-examples

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13923556

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档