【发布时间】:2015-08-25 22:20:34
【问题描述】:
在Java/JSP的精彩世界里,你可以使用这种形式的评论:
<%-- anything in here is ignored and does not get sent to the client
it can span multiple lines and is useful for commenting out blocks
of JSP, including tags and HTML:
<c:if test="${some.condition}">
<p>All this is inside the comment</p>
</c:if>
<!-- this HTML comment is itself commented out of the JSP so will not be sent to the client --!>
--%>
<!-- but this is just an HTML comment and WILL be sent to the client -->
在不那么精彩的 PHP 世界中,我能找到的唯一对 cmets 的引用是:
/*
multi-line comment
*/
还有这些:
// single line comment
但是这些不会注释掉一些 HTML 和 PHP 标记:
/*
<? do_something() ?>
*/
导致 /* 和 */ 被渲染到浏览器,并且 do_something() 仍然被调用。
在 PHP 中是否存在与上面显示的 JSP 注释等效的内容?
【问题讨论】:
-
为了完成,再来一个:
# This is also a php comment