我没有 PHP 经验,但我正在使用:
error_log("big array:" . print_r($bigArray, true));
查看一个大数组内部的内容,但在我看到输出中有趣的内容之前,输出似乎被切断了,如下所示:
...
[4] => Array
(
[id] => 100039235
[start] => 11:00
[end] => 19:00
[punches] => Array
(
[0] => Array
(
[id] => 6319
[comment] =>
这是预期的吗?是否有其他方法或解决方法可以注销更多阵列?
最佳答案
如果您检查error INI options in PHP你会注意到有一个 log_errors_max_len
选项:
Set the maximum length of
log_errors
in bytes. Inerror_log
information about the source is added. The default is 1024 and 0 allows to not apply any maximum length at all. This length is applied to logged errors, displayed errors and also to$php_errormsg
.When an integer is used, the value is measured in bytes. Shorthand notation, as described in this FAQ, may also be used.
因此,如果您想使用 error_log
输出这些巨大的消息,请确保将 log_errors_max_len
更改为一个较大的数字(或 0
长度不受限制)。
// Append to the start of your script
ini_set('log_errors_max_len', '0');
关于php - 使用 print_r 时 error_log 消息被截断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25621252/