Sending “var_dump” to FireBug console

前端 未结 12 1412
忘掉有多难
忘掉有多难 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条回答
  •  猫巷女王i
    2020-12-31 13:21

    You can dump JavaScript to the console by putting a console.log() in a script tag:

    
    

    So if you do a php dump in there...

    
    

    You just need to be careful about ' and " in the var_dump breaking your JavaScript. In this example it will be ok because the HTML would be:

    
    

    Just remember the php is processed then put in the JavaScript. You could also dump it to a comment:

    
    

    Then you can view source, or inspect element.

提交回复
热议问题