我遇到了这个错误。我不知道处理这件事。
无法修改标头信息 - 已经发送的标头(输出 开始于 /home/ben213/public_html/wp-content/themes/Bendaggers/functions.php:9) 在第934行的/home/ben213/public_html/wp-includes/pluggable.php
我的Functions.php文件第9行是:
<?php if(function_exists('register_sidebar'))register_sidebar();?>
,而我的pluggable.php#934
function wp_redirect($ location,$ status = 302){ 全球$ is_IIS;
$location = apply_filters('wp_redirect', $location, $status);
$status = apply_filters('wp_redirect_status', $status, $location);
if ( !$location ) // allows the wp_redirect filter to cancel a redirect
return false;
$location = wp_sanitize_redirect($location);
if ( !$is_IIS && php_sapi_name() != 'cgi-fcgi' )
status_header($status); // This causes problems on IIS and some FastCGI setups
header("Location: $location", true, $status);}
endif;
我很难解决这个问题,因为我不是程序员。什么似乎是错的?请帮助我...
答案 0 :(得分:3)
我会给99.9%这个问题,因为在PHP脚本中的第一个"<?"
之前和最后一个"?>"
之前的某个地方出现了不受欢迎的空白。编辑以不同的编码保存文件也可以添加这样的空白(因为BOM)。所以它并不总是取决于你的注意力。使用Notepad2或其他东西编辑代码,最好尝试在管理控制台中使用内置的在线主题编辑器。尝试找到并消除每个主题的php文件中所有不受欢迎的空格并重新保存这些文件。
答案 1 :(得分:1)
我对wordpress一无所知,但我对http有所了解......也许这会有所帮助。
发生错误是因为您尝试更改标题字段,但标题已经发送。在第一次写入实际页面内容时(自动)发送标题。
(http-headers是发送html页面的http协议的一部分,而不是html文件的一部分。在标题中发送类似状态代码(404等)的编码等等。所以按顺序要开始编写实际页面,必须先写入标题。)
看起来主题(?)过早使用,或“重定向”插件激活得太晚了......
尝试移动“register_sidebar”,直到检查是否进行重定向为止。
编辑:
从阅读其他问题,我可以告诉您需要学习如何编程或使用其他工具。找一两本书,给它一些时间。 PHP是一种相当混乱的语言,因此它并不是理解如何编程的理想选择,但是因为你似乎需要它,所以你就是这样。
祝你好运。答案 2 :(得分:1)
在我的pluggable.php中找到函数wp_redirec
并在其中替换
header("Location: $location", true, $status);
带
echo "<meta http-equiv='refresh' content='0;url=$location' />";
答案 3 :(得分:1)
这就是为我解决问题的原因!在'function.php'第9行'中可能看起来像
?>
<?php
删除空格,使其看起来像:
?>
<?php