如何在 PHP 中写入控制台? [英] How can I write to the console in PHP?
问题描述
是否可以写入字符串或登录到控制台?
Is it possible write a string or log into the console?
就像在 JSP 中一样,如果我们打印诸如 system.out.println("some")
之类的内容,它将在控制台中,而不是在页面中.
Just like in JSP, if we print something like system.out.println("some")
, it will be there at the console, not at a page.
推荐答案
Firefox
在 Firefox 上,您可以使用名为 FirePHP 的扩展程序,它可以记录和转储 PHP 应用程序中的信息到控制台.这是一个很棒的 Web 开发扩展插件 Firebug.
On Firefox you can use an extension called FirePHP which enables the logging and dumping of information from your PHP applications to the console. This is an addon to the awesome web development extension Firebug.
Chrome
但是,如果您使用 Chrome,则有一个 PHP 调试工具,称为 Chrome Logger 或 webug(webug 有日志顺序问题).
However if you are using Chrome there is a PHP debugging tool called Chrome Logger or webug (webug has problems with the order of logs).
最近 Clockwork 正在积极开发中,它通过添加一个新面板来扩展开发者工具提供有用的调试和分析信息.它为 Laravel 4 和 Slim 2 和支持可以通过其可扩展的 API 添加.
More recently Clockwork is in active development which extends the Developer Tools by adding a new panel to provide useful debugging and profiling information. It provides out of the box support for Laravel 4 and Slim 2 and support can be added via its extensible API.
使用 Xdebug
调试 PHP 的更好方法是通过 Xdebug.大多数浏览器都提供辅助扩展来帮助您传递所需的 cookie/查询字符串以初始化调试过程.
A better way to debug your PHP would be via Xdebug. Most browsers provide helper extensions to help you pass the required cookie/query string to initialize the debugging process.
- Chrome - Xdebug 助手
- Firefox - 最简单的 Xdebug莉>
- Opera - Xdebug
- Safari - Xdebug Toggler
这篇关于如何在 PHP 中写入控制台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!