使用 Xampp 为 Wordpress 设置 ChromePhp [英] Setting Up ChromePhp For Wordpress Using Xampp

查看:24
本文介绍了使用 Xampp 为 Wordpress 设置 ChromePhp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现 ChromePhp 可以帮助我调试 PHP,并安装了相关的 Chrome 插件,但我似乎无法让它工作.我最初将它放在我重定向的 htdocs 中的一个文件夹中,并使用以下命令将其添加到我的 xampp php.ini 中的 PHP 路径中:

I found ChromePhp to help with my PHP debugging woahs and installed the related Chrome plugin but I can't seem to get it to work. I originally put it in a folder in my redirected htdocs and added that to my PHP path in php.ini of xampp using:

; Windows: "\path1;\path2"
include_path = ".;C:\xampp\php\PEAR;D:\htdocs\includes"

这似乎不起作用,每当我尝试包含文件并输出 ChromePhp::log("message")

That didn't seem to work I kept getting errors like the one below whenever I tried to include the file and output a ChromePhp::log("message")

警告:无法修改标题信息 - 标题已由 D:\htdocs\ask.ca\wp 中的(输出开始于 D:\htdocs\ask.ca\wp-admin\menu-header.php:91)发送-includes\ChromePhp.php 第 385 行

Warning: Cannot modify header information - headers already sent by (output started at D:\htdocs\ask.ca\wp-admin\menu-header.php:91) in D:\htdocs\ask.ca\wp-includes\ChromePhp.php on line 385

然后我在 Windows 路径中尝试了类似的方法,结果相同.

So then I tried a similar approach in my windows path, with the same result.

最后,我完全进入本地并尝试使用以下方法将 ChromePhp.php 文件包含到我的插件中:

Finally I went completely local and tried to include the ChromePhp.php file into my plugin using:

include( dirname(__FILE__) . '/php/ChromePhp.php' );
ChromePhp::log("Hello World");

但我还是遇到同样的错误???任何人都可以解释让 ChromePhp 工作的 ABC 吗?尽管我阅读了 ChromePhp 的网站说明(以及其他一些人以使其正常工作),但显然我说 ABC 很短而且我认为很简单,我仍然需要更多芝麻街的解释.

But I still get the same error??? Can anyone explain the ABC's of getting ChromePhp to work? I say ABC's since apparently even though I read ChromePhp's website instructions (and couple other peoples in order to get this to work) which are very short and I thought simple, I still need a more Sesame Street explanation.

推荐答案

我是 ChromePHP 的开发人员.您看到此问题是因为页面上已经开始输出.一旦你回显了一些东西,你就不能再设置标题了.

I'm the developer of ChromePHP. You are seeing this problem because output has already started on the page. As soon as you echo something out you can no longer set headers.

查看此相关票证:
https://github.com/ccampbell/chromephp/issues/15

我不确定 Wordpress 的内部工作原理,但基本上你要么在任何输出发送到页面之前记录信息,要么你必须使用输出缓冲来防止输出被发送然后刷新完成日志记录后的缓冲区.

I'm not sure about the internal workings of Wordpress, but basically you have to either log the information before any output has been sent to the page, or you have to use output buffering to prevent output from being sent and then flush the buffer after you are done logging.

还有:
http://wordpress.org/support/topic/error-cannot-modify-header-information-2

这篇关于使用 Xampp 为 Wordpress 设置 ChromePhp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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