json_encode - PHP 给出不完整的 json 字符串
首先是我的设置: PHP 5.3.2 - 使用 Suoshin 和 xCache lighttpd/1.4.26
我的代码太多,无法在这里发布。我将描述它。
文件 x.php 正在加载一些 PHP - Classe,初始化它们,执行一些函数 ->获取结果数组。
如果我 print_r 这个数组,我会得到完整的结果。
但我使用了 json_encode,它每次都会在同一位置进行切割。 -> json 无效。
例子: print_r-
Array
(
[test1] => Array
(
[test2] => 2
[test3] => Array
(
[test4] => 4
)
)
)
json -
{"test1":{"test2":2,"test3":{"te
错误日志显示以下内容:
(mod_fastcgi.c.2582) unexpected end-of-file (perhaps the fastcgi process died): pid: 16708 socket: unix:/tmp/php5.socket-1
(mod_fastcgi.c.3382) response already sent out, but backend returned error on socket: unix:/tmp/php5.socket-1 for /x.php?, terminating connection
问题是我如何跟踪错误是什么?或者有人知道问题是什么?
First my Setting:
PHP 5.3.2 - with Suoshin and xCache
lighttpd/1.4.26
My Code is too much to Post it here. I will discribe it.
File x.php is loading some PHP - Classe, init them, executes some functions -> getting an Result array.
If I print_r this array I get a full result.
But I've I use json_encode, it cuts it every time on the same position. -> json gets invalid.
Example:
print_r-
Array
(
[test1] => Array
(
[test2] => 2
[test3] => Array
(
[test4] => 4
)
)
)
json -
{"test1":{"test2":2,"test3":{"te
Error Log says the following:
(mod_fastcgi.c.2582) unexpected end-of-file (perhaps the fastcgi process died): pid: 16708 socket: unix:/tmp/php5.socket-1
(mod_fastcgi.c.3382) response already sent out, but backend returned error on socket: unix:/tmp/php5.socket-1 for /x.php?, terminating connection
The Question is how can i track whats the Error? Or anybody knows whats the Problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来像是缓冲问题。确保在连接关闭之前刷新响应缓冲区。
Sounds like a buffering problem. Make sure that your response buffer is flushed before the connection is closed.