drymoeuka282427675
2017-07-07 20:03
浏览 190
已采纳

如何在Yii2中注释掉结构<?=?>

a trivial question, but all my efforts to comment out code lines like this:

<?=$form->field($model, 'bew_id')->textInput(['placeholder' => 'Bew']) ?>

failed by using PHP and/or HTML-comments.Following trys didn't success:

//

/* */

<-!- -->

Any ideas??

图片转代码服务由CSDN问答提供 功能建议

这是一个微不足道的问题,但是我所有努力都要注释掉这样的代码行:

 &lt;?= $ form-&gt; field($ model,'bew_id') - &gt; textInput(['placeholder'=&gt;'Bew'])?&gt; 
    
 
 

使用PHP和/或HTML-comments失败。以下尝试没有成功:

//

/ * * /

&lt; - ! - - &gt;

任何想法?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • duanhao9176 2017-07-07 22:02
    已采纳

    Change <?= to <?php and then do the comment

    <?php /*echo  $form->field($model, 'bew_id')->textInput(['placeholder' => 'Bew']) */ ?>
    

    because this

    <?= $form->field($model, 'bew_id')->textInput(['placeholder' => 'Bew']) ?>
    

    is shorthand for

    <?php echo $form->field($model, 'bew_id')->textInput(['placeholder' => 'Bew']) ?>
    

    use any comment // or /* */

    打赏 评论
  • dream8877 2017-07-08 07:26

    Remove <?= at the beginning then you can comment by using <!-- as follows

    <!---$form->field($model, 'bew_id')->textInput(['placeholder' => 'Bew']) ?>-->
    
    打赏 评论

相关推荐 更多相似问题