duanpeng1532
2014-11-24 17:09 阅读 51
已采纳

Chrome开发者工具 - 控制台 - 您可以检查PHP var吗?

I'd like to know if there is a command line API from the Chrome Developer Tools in Console that can be used to view an object?

I'm not looking for something like console.log() which can be placed in the PHP code, but I need to view the variable after the page is rendered on a Production site.

Can this be done via the console?

inspect( {{ myArray }}) valueOf( {{ myArray }}) or values()

Thanks

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    duanlachu7344 duanlachu7344 2014-11-24 17:41

    No, you can't, but you are missing some basic coding and languages fundamentals, like the difference between compiled codes and scripting codes.

    In PHP you cannot debug the code in real time like in compiled codes, except if you configure your IDE (like PHPStorm) to make some real time debugging, but that is an advanced task.

    Supposing that you are coding on a localhost, what you can do is printing your variable with codes like:

    var_dump($your_variable);
    print_r($another_variable);
    

    and your values will be printed out, but you need to reload the page.

    If you are on a good mood, i recommend you take a look on this XDebug and PHPStorm Real time debugging article! .

    点赞 评论 复制链接分享

相关推荐