从代码格式中排除代码部分


Exclude section of code from code formatting

是否有一个注释标签,我可以在其中附上一节(php代码),自动格式化器将忽略?

有时我在php代码中使用一种独特的缩进样式。例如,如果我传入几个数组,我将进行内联初始化。有时这是保持内容可读性的唯一方法。不幸的是,在应用代码格式化程序后,这将丢失。

注释代码的一些方法:

// comment out a single line

您也可以在代码中间使用shell样式的注释,如

<h1>This is an <?php # echo 'simple';?> example</h1>

上面的标题会显示'This is an example'。

最后你可以写多行注释,比如

/* line one
line two and
line three are commented */