Make var_dump look pretty

后端 未结 14 2428
忘掉有多难
忘掉有多难 2020-12-02 04:23

I have a simple $_GET[] query var set for showing testing data when pulling down queries from the DB.


  <         


        
相关标签:
14条回答
  • 2020-12-02 04:59

    The best what and easiest way to get nice var_dump is use xDebug (must have for any php dev) Debian way install

    In console: apt-get install php-xdebug after that you should open php.ini (depends on which stack you use) for it's /etc/php/7.0/fpm/php.ini

    Search for display_errors

    set same -> display_errors = On

    Check html_errors in same file a little bit below, it's also must be On

    Save and exit

    After open /etc/php/7.0/fpm/conf.d/20-xdebug.ini

    And add to the end: ``` xdebug.cli_color=1

    ``` Save and exit.

    A lot other available option and documentation for xdebug can be founded here.

    https://xdebug.org/docs/

    Good luck and Have Fun !!!

    Result

    0 讨论(0)
  • 2020-12-02 04:59

    Here's an alternative, actively maintained open source var_dump on steroids:

    https://github.com/kint-php/kint

    It works with zero set up and has more features than Xdebug's var_dump.

    Example which bypasses the dumped object size limit on the fly with Kint:

         require 'kint.phar';
         +d( $variable ); // append `+` to the dump call
    

    Here's a screenshot:

    kint

    0 讨论(0)
提交回复
热议问题