升华文本2 php endforeach、endif和endwhile与html结束标记混淆
所以问题基本上是自动缩进。 我在f12上自动缩进的用户配置中使用了它升华文本2 php endforeach、endif和endwhile与html结束标记混淆,php,sublimetext2,auto-indent,Php,Sublimetext2,Auto Indent,所以问题基本上是自动缩进。 我在f12上自动缩进的用户配置中使用了它 {“keys”:[“f12”],“command”:“reindent”,“args”:{“single_line”:false} 并在一个带有html代码和php代码的somefile.php中 <div> <?php if(something):?> hello world <?php endif;?> </div> 你好,世界 F
{“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>
你好,世界
//sublime认为endif是一个结束html标记。
是否有办法解决此问题?尝试将其更改为:
<div>
<?php
if(something){
echo "hello world" // I assume you want to print this line to the screen
}
?>
</div>
是的,这是可行的,但从外观上看,这使代码更具可读性。你知道另一种方法来解决这个问题吗?对我来说,两种方法的代码都是可读的。。我不知道为什么会有这样的结局;不起作用。。我会找到它,然后告诉你