How to comment multiple lines in PhpStorm IDE?

2020-05-31 21:33发布

I use PhpStorm to edit PHP files and configuration files for Apache. How to comment on the selected block and set the symbol comment? I want,for example,

   <Directory />
        Options FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
    </Directory>

to

   #<Directory />
   #    Options FollowSymLinks
   #    AllowOverride None
   #    Order deny,allow
   #    Deny from all
   #</Directory>

3条回答
beautiful°
2楼-- · 2020-05-31 22:22

There are two possibilities (in cases where block of comment are available like php, json etc files)

First
Windows: Ctrl+/
Mac: +/

will produce

// comment

Second
Windows: Ctrl+Shift+/
Mac: ++/

will produce

/* comment */
查看更多
Melony?
3楼-- · 2020-05-31 22:35

in mac :

block some lines of codes
command + /
查看更多
Deceive 欺骗
4楼-- · 2020-05-31 22:38

Select multiple lines and use the Comment with Line Comment (Ctrl+/ in the default keymap on Windows, can be changed in Settings | Keymap).

There is also Comment with Block Comment that works for file types that have special style comment for code blocks (not applicable for .htaccess).

查看更多
登录 后发表回答