Debug-How do you debug PHP?

Source: Internet
Author: User
In other words, it seems that there is var_dump ($variable)!
PHP is already very simple, but debugging to manually write, very troublesome.

Reply content:

In other words, it seems that there is var_dump ($variable)!
PHP is already very simple, but debugging to manually write, very troublesome.

I also like var_dump, large point of, engineering words may see xdebug. But the configuration is very troublesome, also not good use.

Debug in Vardump or thinkphp
=========
Bug debugging in THINKPHP5 basically does not need any other tools are built-in.
But the rest of the frame as far as possible with Xdebug bar use this, as long as the error automatically display quick location, of course, conditional can use the Facebook Xhprof

Var_dump+exit enough

    • Simple and intuitive:
 echo "
";    print_r($tmp);
    • Slightly complex:
      The debug, or Xdebug, of the framework is used primarily to view the SQL statements executed, the controller being accessed, the request parameters, and the response status.

    • Suitable for oneself:
      Write your own debug, it is estimated that few people do so, you know

Can be used in pairs var_dump() , debug_backtrace() such as a simple package of small library, input and information output effect is much better than direct var_dump() , recommended two can try:

    • Kint
    • Bugger

For simple logic or projects, Var_dump can do the job.
For complex logic or projects, it is more advantageous to debug with the IDE's own debug. Phpstorm's debugger is good.

How the landlord everywhere to run the post?

Zend Debugger

var_dumpdie

Kint ho Ho, tall on the bar

die('f**k')Sometimes used to find two points

  • Related Article

    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.