PHP 重新格式化var_dump/print_r打印的数组

// 在使用var_dump/print_r时   打印出来的数组 都是一行显示的, 看起来不方便


function
dump($vars, $label = '', $return = false) { if (ini_get('html_errors')) { $content = "<pre> "; if ($label != '') { $content .= "<strong>{$label} :</strong> "; } $content .= htmlspecialchars(print_r($vars, true)); $content .= " </pre> "; } else { $content = $label . " : " . print_r($vars, true); } if ($return) { return $content; } echo $content; return null; }
原文地址:https://www.cnblogs.com/arvin-an/p/8693617.html