在Java/JSP的奇妙世界中,您可以使用以下形式的注释:
在 PHP 这个不是很美妙的世界中,我能找到关于注释唯一的参考资料如下所示:
但是这些不会注释掉HTML和PHP标记的一部分内容:
<%-- 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 这个不是很美妙的世界中,我能找到关于注释唯一的参考资料如下所示:
/*
multi-line comment
*/
还有这些内容:
// single line comment
但是这些不会注释掉HTML和PHP标记的一部分内容:
/*
<? do_something() ?>
*/
将 /* 和 */ 渲染到浏览器中,而 do_something() 仍然被调用。
在 PHP 中是否有与上面显示的 JSP 注释相当的等效物?
#这也是PHP注释
。 - ksbg