Sending “var_dump” to FireBug console

前端 未结 12 1410
忘掉有多难
忘掉有多难 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:24

    FirePHP does the job well + you can use it while you're developing Ajax.

    Sample code:

    require_once('FirePHPCore/fb.php'); # add the library
    
    fb($var); #log the variable
    fb( var_export($var,true) ); # log the variable with the var_export format
    

    If you're passing an array to it, you can click it from your console and it will open a popup on your screen. You can even expand/collapse arrays and objects.

    EDIT: If you're looking for data types and length, use var_dump().

    fb( var_dump( array(
        1,
        'a',
        true
      ) ) );
    

提交回复
热议问题