Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of PhpStorm Local breakpoint debugging

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article shares with you the content of a sample analysis of PhpStorm local breakpoint debugging. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

Foreword:

When debugging php code, it is often print_r or var_dump to break point, but when the project is more complex, the efficiency is very low, breakpoint debugging is very good to solve this problem. It may not be suitable for breakpoint debugging at first, but when you get used to it, it becomes more and more comfortable.

Note: the following is in the windows7+apache environment

1. Build the breakpoint debugging php environment

1. Check whether Xdebug is installed in the local php environment

Output phpinfo () locally; search for Xdebug; as follows

If not, the installation operation Xdebug is as follows:

Enter all the information of phpinfo (); into the box in http://xdebug.org/wizard.php to get the appropriate xdebug version, as shown in the following figure.

2. After installing Xdebug, configure the local php.ini. The added configuration is as follows. If you need to add other Xdebug configurations, you can check the xdebug configuration in phpinfo and add it yourself according to the situation.

[xdebug]; zend_extension: enter zend_extension = "D:/IdeMix442_jcp/php-5.5.27-Win32-VC11-x64/ext/php_xdebug-2.2.5-5.5-vc11-x86_64.dll" xdebug.idekey=phpstormxdebug.remote_enable = Onxdebug.remote_host=localhost;xdebug.remote_port according to your local environment. The default value is 9000, which needs to be consistent with the phpstorm configuration. Here is xdebug.remote_port=9000xdebug.remote_handler=dbgpxdebug.auto_trace = On.

3. Then configure phpstorm, in which the Debug port is not occupied by other applications. When the program cannot enter the breakpoint, you can consider whether other applications occupy your local port 9000.

4. Install the Xdebug extension to your chrom browser

Xdebug download address: https://www.jb51.net/softs/544430.html

After downloading, extract it, select one of the versions, and install it in your chrom browser (just drag it into the browser's extension). The 360 speedy browser I tested myself is also possible. After the installation is complete, a crawler appears in the upper right corner of the browser, as shown below.

Start debugging your breakpoint

1. In the browser where you have installed the Xdebug extension, open a page of your local project. And open the debug in the upper right corner of the browser, as shown below.

2. In your phpstorm editor, open the code that you want to go through on the page in the browser, and click on the following figure.

3. Refresh the page you opened in your browser again, and then take a look at your phpstorm editor. The red circle of the breakpoint on the left becomes a check mark in the circle, which means you have entered the breakpoint. The figure below is as follows

Third, some simple operations of breakpoint debugging

1. Check the values of some variables before your breakpoint

Double-click the variable you want to view, hover over it, and the value will appear. Or click the right mouse button when selected and select add to Monitoring (English version is add to watch), as shown below

2, from the beginning of your breakpoint, you can press F7, the program will go down step by step, encounter a function, it will jump to the function; press F8 is in the current code page one line down, encounter the function will not jump. These two functions are the most practical and key functions of breakpoint debugging.

3. When you want to jump directly from one breakpoint to another line, you can enter the breakpoint, click the breakpoint at the breakpoint where you want to be in another line, and then press F9 or click the green button in the lower border, as shown below.

4. When you have multiple breakpoints and open multiple files due to breakpoint debugging, if you want to see where your breakpoints are, you can press Ctrl+Shift+F8 to browse the breakpoints

5, breakpoint debugging there are many tips, you can slowly find and explore in use.

Thank you for reading! This is the end of the sample analysis of PhpStorm local breakpoint debugging. I hope the above content can be helpful to you so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report