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

如何在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??

  • 写回答

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 /* */

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?