CakePHP debug()不工作,但Debugger :: dump()很好

编程入门 行业动态 更新时间:2024-10-27 20:25:11
本文介绍了CakePHP debug()不工作,但Debugger :: dump()很好的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

自从PHP4和Cake 1.3以来,我一直使用 debug($ data); 来调试CakePHP中的模型输出。

Ever since PHP4 and Cake 1.3 I have been using debug($data); to debug things such as model output in CakePHP.

但是,从升级到PHP5.4,我注意到 debug($ data)并不总是工作。例如,今天我做了一个简单的 $ data = $ this-> Model-> find('all'); debug($ data); 显示为空。没有错误,只是在HTML输出中引用事实,我调用调试和行号,然后没有调试输出。

However, since upgrading to PHP5.4, I have noticed that debug($data) doesn't always seem to work. For example, today I did a straightforward $data = $this->Model->find('all'); and the contents of debug($data); appears to be empty. No error, just a reference in the HTML output to the fact that I called debug and the line number and then no debug output.

但是,如果我运行 Debugger :: dump($ data); 对完全相同的find,它工作find和我看到整个输出。

However, if I run Debugger::dump($data); on the exact same find, it works find and I see the entire output.

它似乎只发生在 $ data 有大量的数据(例如,100+记录),但我使用的数据集这个大小之前PHP5.4和那里从不是一个问题,没有错误,inline或在apache / php日志表明有任何内存问题,我有调试设置为3。

It seems to only be happening when $data has a significant amount of data (say, 100+ records), but I worked with datasets this size prior to PHP5.4 and there was never a problem and there are no errors, inline or in the apache/php logs indicating that there are any memory issues and I have debugging set to 3.

有人有什么想法为什么这是?我可以方便地开始使用 Debugger :: dump($ data); ,但它只是一个额外的尝试每次,我想知道为什么我

Does anyone have any idea why this is? I can obviosly starting using Debugger::dump($data); easily but it's just a little extra to have to try out each time and I'd like to know why I can't just use deubg(); anymore.

推荐答案

这不能只使用 deubg();

This can happen with non-utf8 encoded data in your db records - if the rest of your application is UTF-8 that is. debug() will then just output "nothing". var_dump(), print_r() and other php internal methods should still print the output, though.

您通常可以使用iconv()等将它们重新编码为utf8。

You can usually re-encode them to utf8 using iconv() etc.

更多推荐

CakePHP debug()不工作,但Debugger :: dump()很好

本文发布于:2023-11-07 04:29:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1565569.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:很好   工作   debug   CakePHP   Debugger

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!