I use this function for debugging:
function d($v,$tofile=null) {
static $wasused;
ob_start();
var_dump($v);
$dump = ob_get_clean();
if (is_array($v)) $dump = preg_replace("@=>\n@",'=>',$dump);
if (strlen($dump)>1000 or $tofile) {
fileput('debug.txt',$dump,$wasused);
echo n.n."strlen=".strlen($dump)." >> debug.txt".n.n;
}
elseif (strlen($dump)<80) echo $dump;
else echo n.n.$dump.n.n;
$wasused=true;
}
the problem is it sometimes return content to console, particularly when this content is var_dump result on a big array,
anyone of you have s开发者_运维知识库een this problem before ?
If this is in your php.ini
:
implicit_flush = On
change it to this:
implicit_flush = Off
Before assuming that there is a problem with var_dump itself, one would need to verify that fileput() does exactly what the question implies.
精彩评论