[英]How to comment out a HTML line with Php inside?
我知道答案很简单,但我在任何地方都找不到。如何禁用这条线? 我试过了,但 id 不起作用
//
<!-- -->
/* */
<a class="switch" data-mode="<?php echo Session::cookieExists("myTheme", "dark") ? "dark" : "light";?>">
<?php
// <-- this is a comment in PHP, java and javascript (prob others) - NOT HTML
/* this is also a type of comment in PHP, java, javascript and css (and prob others) */
?>
<!-- This is an html comment
The PHP code inside it will still run, but the result will be commented out. -->
<!-- <a class="switch" data-mode="<?php echo Session::cookieExists("myTheme", "dark") ? "dark" : "light";?>"> -->
<!-- This is the element with the PHP code inside commented out -->
<a class="switch" data-mode="<?php /* echo Session::cookieExists("myTheme", "dark") ? "dark" : "light"; */ ?>">
您可以添加两条注释: <!-- -->
用于 HTML 的<p>
标签和/* */
用于 PHP 内<?php?>
<?-- <a class="switch" data-mode="<:php /* echo Session:,cookieExists('myTheme'? 'dark'): 'dark'; 'light'? */ ?>"> -->
您可以在 html 中注释 php 代码如下:
<a class="switch" data-mode="<?php /* echo Session::cookieExists("myTheme", "dark")? "dark": "light"; */?>">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.