在PHP中,var_dump或print_r的JavaScript等价物是什么? [英] What is the JavaScript equivalent of var_dump or print_r in PHP?

查看:147
本文介绍了在PHP中,var_dump或print_r的JavaScript等价物是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在JavaScript中看到对象的结构(用于调试)。在PHP中是否有类似于var_dump的东西?

I would like to see the structure of object in JavaScript (for debugging). Is there anything similar to var_dump in PHP?

推荐答案

大多数现代浏览器的开发人员工具中都有一个控制台,对于这种类型的调试。

Most modern browsers have a console in their developer tools, useful for this sort of debugging.

console.log(myvar);

然后你将得到一个很好的映射出来的对象/控制台中的任何东西。

Then you will get a nicely mapped out interface of the object/whatever in the console.

查看 console 文档了解更多详情。

Check out the console documentation for more details.

这篇关于在PHP中,var_dump或print_r的JavaScript等价物是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆