簡體   English   中英

Sublime Text 2 PHP Endforeach,Endif和Endwhile混淆Widh HTML關閉標記

[英]Sublime Text 2 php endforeach, endif, and endwhile get confused widh html closing tag

因此,問題基本上是自動縮進。 我在用戶配置中將此用於f12的自動縮進

{ "keys": ["f12"], "command": "reindent", "args": {"single_line": false} }

並在帶有HTML代碼和PHP代碼的somefile.php中

<div>
    <?php if(something):?>
         hello world
    <?php endif;?>
</div>

F12結果

<div>
    <?php if(something):?>
        hello world
<?php endif;?> //sublime is thinking the endif is a closing html tag.
</div>

有沒有辦法解決這個問題?

嘗試將其更改為:

<div>
<?php 
    if(something){
      echo "hello world" // I assume you want to print this line to the screen
    }
 ?>
</div>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM