php - 使用 print_r 时 error_log 消息被截断

标签 php

我没有 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. In error_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/

相关文章:

php - 如何更改 WordPress 中的 ABSPATH?

php - 可以使用一个或多个值进行搜索的搜索功能

php - 尝试通过 HTML 和 php 将数据插入 Mysql 数据库时出错

php - 如何将 netbeans ide 和 wamp 服务器一起用于 php 项目

javascript - 尝试在 WordPress PHP 循环中运行一些 jQuery 以定位动态标题并使用 jQuery 中的 Circle 库围绕鼠标旋转标题

php - 此页面包含以下错误 : error on line 1 at column 1: Document is empty

插入时出现 PHP/Mysql 语法错误

php - mysql从任何距离参数返回相同的结果

php - Codeigniter 路线和语言标识符

php - 如何用单引号替换双引号