使用print_r时error_log消息被截断 [英] error_log message is truncated when using print_r

查看:122
本文介绍了使用print_r时error_log消息被截断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有PHP经验,并且正在使用:

I'm not experienced in PHP and I'm, using:

error_log("big array:" . print_r($bigArray, true));

查看大数组中的内容,但在我获得输出中的有趣内容之前,似乎已切断了输出:

to look at what's inside a big array but it looks like the output is cut off before I get to the interesting stuff in the output like so:

...
           [4] => Array
            (
                [id] => 100039235
                [start] => 11:00
                [end] => 19:00
                [punches] => Array
                    (
                        [0] => Array
                            (
                                [id] => 6319
                                [comment] => 

这是预期的吗?还有其他方法或解决方法来注销更多的阵列吗?

Is this expected? Are there other ways or workarounds to get more of the array logged out?

推荐答案

如果您选中 PHP中的错误INI选项,您会注意到有一个 log_errors_max_len 选项:

If you check the error INI options in PHP you'll notice there's a log_errors_max_len option:

以字节为单位设置log_errors的最大长度.在error_log中,添加了有关源的信息. 默认值为1024,并且0允许根本不应用任何最大长度.此长度适用于记录的错误,显示的错误以及$php_errormsg.

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更改为无限长度).

Hence, if you want to use error_log to output these huge messages, make sure you change log_errors_max_len to a large number (or 0 for unlimited length).

// Append to the start of your script
ini_set('log_errors_max_len', 0);

这篇关于使用print_r时error_log消息被截断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆