Debugging code with breakpoints in PHPStorm
The XDebug plug-in needs to be installed . The efficiency of using breakpoint debugging for complex projects is higher than using traditional debugging methods such as echo and var_dump . For most developers who are not masters, using breakpoint debugging is also more efficient than traditional debugging. High, because you can walk and see the results of each variable.
The first step is to create a file that outputs php configuration information.
First find out if there is any information about XDebug; if not, go to https://xdebug.org/ to download
Many people fail to install because the version is not selected correctly, I will teach you how to choose the version
There is a hyperlink under Releases , click to enter
Need to enter phpinfo information
Copy select all, paste in box
Click to analyze
Follow the prompts, then configure
In php.ini ,
[XDebug]
xdebug.profiler_output_dir="D:\phpStudy\tmp\xdebug"
xdebug.trace_output_dir="D:\phpStudy\tmp\xdebug"
;zend_extension="D:\phpStudy\php\php-7.0.12-nts\ext\php_xdebug.dll"
zend_extension="D:\phpStudy\php\php-7.0.12-nts\ext\php_xdebug-2.6.0-7.0-vc14-nts.dll"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey="PHPSTORM"
Restart and verify if xdebug is successful
Next, let's configure PHPStorm
Configure the server first
You can configure something like mine
The key is the latter, hit a breakpoint to start our breakpoint debugging, configure the parameters in other places, such as Postman can also use breakpoints for debugging