PhpStorm:如何分离 PHP 和 HTML 缩进

标签 php html phpstorm indentation

是否可以配置 PhpStorm 8 来分别缩进 HTML 和 PHP 代码?

我将从这个问题中复制示例:How to properly indent PHP/HTML mixed code?

PhpStorm 当前如何格式化代码:

<table>
  <?php foreach ($rows as $row): ?>
    <tr>
      <?php if ($row->foo()): ?>
        <?php echo $row ?>
      <?php else: ?>
        Something else
      <?php endif ?>
    </tr>
  <?php endforeach ?>
</table>

我希望它看起来像什么:

<table>
<?php foreach ($rows as $row): ?>
  <tr>
  <?php if ($row->foo()): ?>
    <?php echo $row ?>
  <?php else: ?>
    Something else
  <?php endif ?>
  </tr>
<?php endforeach ?>
</table>

最佳答案

不,目前不可能。参见 this comment

关于PhpStorm:如何分离 PHP 和 HTML 缩进,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30675725/

相关文章:

php - Google 搜索字词 - 包含搜索内容的着陆页

php - 如何执行任务避免用户被迫等待响应?

html - 当我悬停 "a"时,我的 "id"也悬停

javascript - 淡化整个窗口 - 然后加载 URL?

symfony - 从Symfony 3.1开始不推荐使用不以 “%”指示符开头的标量

php - 使用 PHP 和 IFrame 在本地覆盖网页样式

php - 检查字符串是否会在 PHP 中转换为日期

javascript - 显示两个 jQuery 叠加层

laravel - 如何使用 Laradock 和 PhpStorm 配置 Xdebug

PHPStorm - 如何设置实时编辑