How to debug PHP in the MAMP?

后端 未结 1 622
面向向阳花
面向向阳花 2020-12-22 07:11

I\'m using MAMP on Windows to start a web server for my WordPress website. I want to debug some PHP code (at least write variable values to log/browser console/anywhere else

相关标签:
1条回答
  • 2020-12-22 07:33

    If you want to debug WordPress, just turn on debug mode. Add this into your wp-config file instead of this one define( 'WP_DEBUG', false );

    Add this code:

    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true );
    define( 'WP_DEBUG_DISPLAY', false );
    

    Next step is just using this one:

    error_log(print_r($args,true));
    

    Your $args you'll see in the {your-local-website-path}/wp-content/debug.log file

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