问题
I highly prefer the firefox developer inspector than the firebug one.
But is that possible to display PHP logs in the native JS console ?
Thanks :)
回答1:
I just installed Chrome Logger ( github | website ) with Chrome PHP to accomplish this in Chrome since Firefox 50+ broke FirePHP. I then learned that Firefox's web console has been supporting Chrome Logger since v43 (https://developer.mozilla.org/en-US/docs/Tools/Web_Console/Console_messages#Server).
So in short, yes, you can log PHP variables to the Firefox web console using Chrome PHP. It's this simple:
- Download the latest Chrome PHP library: https://github.com/ccampbell/chromephp
- Include it in your project (
include 'ChromePhp.php';
) - Log something in your php script (
ChromePhp::log($_MyArray);
) - Open Firefox web console and turn on the Server tab (https://developer.mozilla.org/en-US/docs/Tools/Web_Console/Console_messages#Filtering_by_category)
Hope this helps. I procrastinated upgrading Firefox for a few years before discovering that newer versions had support for this.
来源:https://stackoverflow.com/questions/30639534/php-logs-in-native-console-firefox-developer