Sending “var_dump” to FireBug console

前端 未结 12 1408
忘掉有多难
忘掉有多难 2020-12-31 13:11

As you know var_dump() in addition to value show its data type and length.

Is there any way to log its output to

12条回答
  •  [愿得一人]
    2020-12-31 13:23

    if you just want to see the var_dump out put in the firebug (client side) without doing any things in Javascript I would recommande using cookies following is an illustration how you can perform it that way:

    ";
    echo $str."\n";
    
    function sendVarDumpToFront( $mixed ){
        ob_start();
        var_dump($mixed);
        $content = ob_get_contents();
        ob_end_clean();
        setcookie("var_dump",$content);
    }
    

    than you can have it in firebug this way:

    reading cookie content from Firebug

    IMPORTANT

    since this way uses cookies you will have to put the var_dump content before outputing any content otherwise this will not work

提交回复
热议问题