Debug-how did you debug PHP?

Source: Internet
Author: User
In other words, it seems that var_dump ($ variable) is everywhere! Php is already quite simple, but debugging requires manual writing, which is very troublesome. It seems like var_dump ($ variable) is everywhere!
Php is already very simple, but debugging requires manual writing, which is very troublesome.

Reply content:

In other words, it seems that var_dump ($ variable) is everywhere!
Php is already very simple, but debugging requires manual writing, which is very troublesome.

I also like var_dump. If it is large or engineering, it may be xdebug. However, configuration is too cumbersome and not easy to use.

Debug in vardump or thinkphp
==========
The bug debugging in thinkphp5 basically does not require any other tools to be built in.
However, if you try to use xdebug for other frameworks, you can use the xhprof of facebook if an error occurs and the quick location is displayed automatically.

Var_dump + exit is sufficient

  • Simple and intuitive:
    echo "
";    print_r($tmp);
  • Slightly complicated:
    The framework debug or xdebug is mainly used to view the executed SQL statements, access controllers, request parameters, and response status.

  • Suitable for you:
    Write debug by yourself. It is estimated that few people do this. You know

Availablevar_dump(),debug_backtrace()And other small libraries that are simply encapsulated by functions. The input and information output results are both direct.var_dump()A lot better. We recommend you try two of them:

  • Kint
  • Bugger

Var_dump can be used for simple logic or projects.
For complex logic or projects, debugging with the debug provided by IDE is more advantageous. The PHPStorm debugger is quite good.

How can I post messages everywhere?

Zend debugger

var_dumpdie

Kint zhuyun.

die('f**k')Sometimes used for Binary Search

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.