php中自定义函数dump查看数组信息类似var

这个很早就有了,比php自带的var_dump好用多了。

复制代码 代码如下:


function dump($vars, $label = '', $return = false) {
if (ini_get('html_errors')) {
$content = "<pre>\n";
if ($label != '') {
$content .= "<strong>{$label} :</strong>\n";
}
$content .= htmlspecialchars(print_r($vars, true));
$content .= "\n</pre>\n";
} else {
$content = $label . " :\n" . print_r($vars, true);
}
if ($return) { return $content; }
echo $content;
return null;
}

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/ce4b87e22e2922e53c38bd618ed390c8.html