当前位置:   article > 正文

php格式化输出array,dump_array 将数组内容格式化输出

php array_dump

/**

* [dump_array 将数组内容格式化输出]

* @param array $vars [数组]

* @param string $label [分隔符]

* @param boolean $return [是否返回结果]

* @return [type] [description]

*/

function dump_array($vars, $label = '', $return = false) {

if (ini_get('html_errors')) {

$content = "

\n";

if ($label != '') {

$content .= "{$label} :\n";

}

$content .= htmlspecialchars(print_r($vars, true));

$content .= "\n

\n";

} else {

$content = $label . " :\n" . print_r($vars, true);

}

if ($return) { return $content; }

echo $content;

return null;

}

本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/67752
推荐阅读
相关标签
  

闽ICP备14008679号