php中自定义函数dump查看数组信息类似var_dump
author:一佰互联 2019-04-29   click:181
这个很早就有了,比php自带的var_dump好用多了。
复制代码 代码如下:
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;
}