如何注释掉 HTML 文件中的 PHP 行?
在我的 HTML 代码中间,有一行 PHP 代码。现在,我想将 PHP 行作为注释。 我尝试使用 但它似乎不适用于 PHP。
我应该怎么办?
谢谢
In the middle my HTML code, I have a line of PHP. now, I want to make PHP line as a comment.
I tried to ues <!-- -->
but it seems not work for PHP.
What should I do?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
假设你有下面的代码:
如果你想让div回显但不显示在页面上,你会注释html,PHP仍然会被执行:
如果你不希望div出现在注释 html 的源代码中,您必须注释 php,源代码的 body 标记之间不会出现任何内容:
Imagine you have the following code:
If you want the div to be echoed but not displayed at the page, you'll comment html, PHP still gets executed:
If you don't want the div to appear at the source as commented html, you'll have to comment php, nothing will appear between the body tags at your source:
PHP语法的所有注释方法都在HTML内的嵌入代码中起作用。
随意使用任何人。
您还可以在 php 标签之外使用 HTML 注释语法。
请注意,PHP 代码仍将被执行。
All the commenting methods of PHP syntax works in the embedded code inside HTML.
Feel free to use anyone.
also you can use the HTML comment syntax just outside the php tags.
Note that the PHP code will still be executed.
您需要使用 PHP 注释 而不是 HTML 注释
请注意,出于安全原因,在使用
注释掉包含 PHP 代码的 HTML 块时,您应该隐藏 PHP 代码,否则您的源代码将可见当查看页面时。
You need to use PHP Comments not HTML comments
<!-- -->
Note that you should hide PHP code for security reasons when commenting out a chunk of HTML containing PHP code using
<!-- -->
otherwise your source code will be visible when page is viewed.使用
或
或
Use
Or
Or
使用常用的 HTML 注释标签注释掉您想要的任何代码。 php 的 p 和 h 之间加一个空格。出于历史目的,请为将来可能进行任何编辑的任何其他代码作者添加附加注释。
*注意:建议仅在注释掉的代码最终被删除时临时使用。 (我在等待客户批准时使用了它。)
Comment out whatever code you wish with the usual HTML comment tags. Put a space between the p and h of php. For historical purposes, add an additional comment for any other code author who may do any editing in the future.
*Note: Recommended for temporary use only when the commented out code will eventually be deleted. (I used it while waiting for approval from a client.)