一种流行的注释方法是分别注释掉 html 和 php。 " title=""> --> 有更好的方法吗? 最佳答案 " title=""> -6ren">
gpt4 book ai didi

php - 如何在 HTML 中的 PHP 中同时注释掉 HTML 和 PHP?

转载 作者:行者123 更新时间:2023-12-02 01:03:00 25 4
gpt4 key购买 nike

这里有一行代码我想注释掉,

<h1 class="post_title"><a href="<?php the_permalink();?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>

一种流行的注释方法是分别注释掉 html 和 php。

<!--    <h1 class="post_title">
<a href="<?php // the_permalink();?>" title="<?php the_title_attribute(); ?>">
<?php // the_title(); ?></a>
</h1>
-->

有更好的方法吗?

最佳答案

<!--    <h1 class="post_title">
<a href="<?php // the_permalink();?>" title="<?php the_title_attribute(); ?>">
<?php // the_title(); ?></a>
</h1>
-->

这只会评论 HTML 部分,因为您会在网页的 View 源代码中找到呈现的 PHP 代码。

更好的方法..

 <?php /*    <h1 class="post_title">
<a href="<?php // the_permalink();?>" title="<?php //the_title_attribute(); ?>">
<?php // the_title(); ?></a>
</h1>
*/ ?>

关于php - 如何在 HTML 中的 PHP 中同时注释掉 HTML 和 PHP?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26334348/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com