Home >Backend Development >PHP Tutorial >About PHPstorm usage tips, PHPstorm usage tips_PHP tutorial
Slowly update, little by little, they are all problems encountered in use
Settings: (2016.4.15)
1: Comment template, phpstorm has a very powerful comment template, which can be changed at any time according to your own needs and set shortcut keys, which is very convenient
New file comment PHP File Header
<span><?<span>php </span><span>/*</span><span>* * Created by PhpStorm. * User: Administrator * Date: 2016/4/13 * Time: 22:44 </span><span>*/</span></span>
Class Comment PHP Class Doc Comment
<span><span>/*</span><span>* * Class index * * @package application\controller * @VERSION 1.3 * @AUTHOR mask </span><span>*/</span> <span>class</span> index <span>extends</span><span> controller {</span></span>
Function Comment PHP Function Doc Comment
<span> <span>/*</span><span>*获取配置类对象 *author : stubborRookie * * @return config *version :1.3 </span><span>*/</span> <span>public</span> <span>static</span> <span>function</span><span> config() { </span><span>return</span> <span>new</span><span> config(); }</span></span>
Customize your own template:
File->setting->editor->File and code Templates
You can set different display fields according to the rules inside
Custom fields:
Using your own name in comments is usually ${USER} But this defaults to the name of the computer, how do you change it to your own?
You can select the Includes tab, then click on the upper left corner of the panel to create a new template and name it: PHP define (can be customized) extension Namephp
Then write the following code inside:
<span><span>#</span><span>set ($VERSION="1.3")</span><span> #</span><span>set ($USER='stubbornRookie')</span></span>
Define the variable and assign the value, and introduce it in the template that needs to use the variable, such as:
<span><span>#</span><span>parse("PHP define.php")</span><span> /*</span><span> * author = ${USER} * * version =${VERSION} </span><span>*/</span></span>
That’s it!
Enter /** where comments are required, such as the method name, and then press Ctrl enter Autocomplete comments!
Editor Font
can be set in the editor. You need to make a copy of the settings to set it.