Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将文本与phpstorm或webstorm中的特定字符对齐?_Php_Text_Alignment_Phpstorm_Webstorm - Fatal编程技术网

如何将文本与phpstorm或webstorm中的特定字符对齐?

如何将文本与phpstorm或webstorm中的特定字符对齐?,php,text,alignment,phpstorm,webstorm,Php,Text,Alignment,Phpstorm,Webstorm,我有这篇课文 $test1 = 'testing1'; $test1test1 = 'testing1'; $test1test1test1 = 'testing1'; $test1 = 'testing1'; 我想像这样对齐它,使用制表符 $test1 = 'testing1'; $test1test1 = 'testing1'; $test1test1test1 = 'testing1'; $test1 = 'testing1'; 在ph

我有这篇课文

$test1 = 'testing1';
$test1test1 = 'testing1';
$test1test1test1 = 'testing1';
$test1 = 'testing1';
我想像这样对齐它,使用制表符

$test1           = 'testing1';
$test1test1      = 'testing1';
$test1test1test1 = 'testing1';
$test1           = 'testing1';
在phpstorm或webstorm中是否有这样做的方法?

Cmd+Alt+L(在Mac中)或Ctrl+Alt+L(Win)和PHP Storm将根据您在设置中的代码样式设置代码的格式。要设置此代码样式,请执行以下操作:
文件->设置->代码样式->PHP(在此选择您的语言)->其他->对齐键值对-标记为选中。然后按“重新格式化代码”(Ctrl+Alt+L)和“瞧”。您将获得上面编写的代码样式。

在PhpStorm 8中,该选项位于:

File -> Settings -> Code style -> PHP -> Wrapping and Braces -> Assignment statement

phpstorm 8中的格式化选项

设置>代码样式>php>换行和大括号

选中这两个选项 对齐选项中的字段并对齐常量

现在你可以得到你想要的了!:)


来源

我在PhpStorm 8.0.2中找到它:

设置->编辑器->代码样式->PHP->换行和大括号->对齐连续指定


Mac上2019.1的可视化更新:

转到
PHP-Storm
首选项
编辑器
代码样式
PHP
包装和大括号
赋值语句
对齐连续赋值

要激活它,请转到
code
重新格式化代码
或按
Cmd+Opt+L


我们必须检查以下多个选项才能获得

  • 上述问题
  • 数组的键值对对齐

您要找的是“对齐连续作业”选项吗?Check.ctrl+alt+shft+L source::它不适用于phpstorm 6.0.3版本,尽管我也为此做了设置。你能帮我在Win7上使用PHPStorm6.0.3吗?我在ALT+F8上有“代码重新格式化”。这可能取决于您正在使用的操作系统和键映射设置。单击菜单中的“代码->重新设置代码格式”-您还应通过“重新设置代码格式”菜单选项看到键盘快捷键。请注意,还有一个“对齐键=>值对”的设置(至少在PHPStorm 6.0.3中)。回答得很好,谢谢。JavaScript也可以这样做吗?我在phpStorm 9.x“对齐列中的字段”中找不到选项…:/“赋值语句>对齐连续赋值”也表示“将文本对齐到特定字符,我还将添加检查数组初始值设定项>对齐键值对。提供的答案可能是正确的,但@Sam提供的答案也是必需的。