简体   繁体   English

PhpStorm - 如何在 PHP 标签中格式化 HTML 代码

[英]PhpStorm - How to format HTML code in PHP tags

I don't understand how can I format correctly HTML code when is surrounded between PHP tags when I click "Auto-Indent Lines".当我单击“自动缩进行”时,我不明白在 PHP 标记之间包围时如何正确格式化 HTML 代码。

What do I expect:我期待什么:

在此处输入图片说明

What PhpStorm does when I click "Auto-Indent Lines".:当我单击“自动缩进行”时,PhpStorm 会做什么:

在此处输入图片说明

Please see comments in WI-17786 .请参阅WI-17786 中的评论。 In general, it's not currently possible to format HTML mixed with PHP通常,目前无法将 HTML 与 PHP 混合进行格式化

在此处输入图片说明

You can change that behaviour in the PHPStorm Preferences.您可以在 PHPStorm 首选项中更改该行为。 Open your Preferences... When the Window opens;打开您的首选项...当窗口打开时; type Code Style to search for that Keyword.键入代码样式以搜索该关键字。 Then under the Menu select HTML.... Here You can decide how your HTML would be formatted or you may select any Language like PHP...然后在菜单下选择 HTML...。在这里您可以决定 HTML 的格式,或者您可以选择任何语言,如 PHP...

However;然而; you may have to restart PHPStorm for the Effect to take place.您可能需要重新启动 PHPStorm 才能生效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM