Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在MAMP中调试PHP?_Php_Wordpress_Mamp - Fatal编程技术网

如何在MAMP中调试PHP?

如何在MAMP中调试PHP?,php,wordpress,mamp,Php,Wordpress,Mamp,我正在Windows上使用MAMP为我的WordPress网站启动一个web服务器。我想调试一些PHP代码(至少将变量值写入日志/浏览器控制台/任何其他地方)。我尝试用PHP源代码编写以下代码: debug_to_console($args); var_dump($args); error_log(print_r($args,true)); 并在MAMP/logs/phperor.log中查找结果。但它什么也没写 在这种情况下如何调试PHP代码?如果您想调试WordPress,只需打开。将此文

我正在Windows上使用MAMP为我的WordPress网站启动一个web服务器。我想调试一些PHP代码(至少将变量值写入日志/浏览器控制台/任何其他地方)。我尝试用PHP源代码编写以下代码:

debug_to_console($args);
var_dump($args);
error_log(print_r($args,true));
并在MAMP/logs/phperor.log中查找结果。但它什么也没写


在这种情况下如何调试PHP代码?

如果您想调试WordPress,只需打开。将此文件添加到
wp config
文件中,而不是将此文件添加到
define('wp_DEBUG',false)

添加此代码:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
下一步就是使用这个:

error_log(print_r($args,true));

你的
$args
你将在
{Your local website path}/wp content/debug.log
文件中看到如果你想调试WordPress,只需打开它。将此文件添加到
wp config
文件中,而不是将此文件添加到
define('wp_DEBUG',false)

添加此代码:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
下一步就是使用这个:

error_log(print_r($args,true));

您的
$args
您将在
{Your local website path}/wp content/debug.log
文件中看到,由于某些原因,这不起作用。$test='a';错误日志(打印($test,true));出于某种原因,这不起作用。$test='a';错误日志(打印($test,true));