Possible Duplicate:
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
您可以使用heredocs或nowdocs(参见下面的heredocs)。
遗传的
现在文档
相关问题 更多 >
编程相关推荐