工具|PHP格式化输出数组

niecprea
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;
}

参考:

  1. http://www.birdol.com/web/751.html

阅读 6.9k

ThinkingPool
Y1RReE5qazFOVFl5

Hello world!

856 声望
54 粉丝
0 条评论
你知道吗?

Hello world!

856 声望
54 粉丝
宣传栏