【发布时间】:2012-07-03 22:54:34
【问题描述】:
我在开发插件时遇到此错误。
在 localhost 中工作正常,但在远程服务器中失败:
警告:无法修改标头信息 - 标头已由 (输出开始于 /path_wordpress/public_html/wp-admin/includes/template.php:1657)在 /path_wordpress/public_html/wp-includes/pluggable.php 在第 866 行
我已删除文件开头和结尾前后的所有空格(此错误的常见原因)并且不涉及任何会话。
还有什么原因?
===
编辑 1
wp-admin/includes/template.php:
$attributes = '';
if ( is_array( $other_attributes ) ) {
foreach ( $other_attributes as $attribute => $value ) { // line 1657
$attributes .= $attribute . '="' . esc_attr( $value ) . '" '; // Trailing space is important
}
} else if ( !empty( $other_attributes ) ) { // Attributes provided as a string
$attributes = $other_attributes;
}
===
编辑 2:
wp-admin/wp-includes/pluggable.php:
if ( !function_exists('wp_redirect') ) :
/**
* Redirects to another page.
*
* @since 1.5.1
* @uses apply_filters() Calls 'wp_redirect' hook on $location and $status.
*
* @param string $location The path to redirect to
* @param int $status Status code to use
* @return bool False if $location is not set
*/ // line 866
function wp_redirect($location, $status = 302) {
global $is_IIS;
【问题讨论】:
-
有代码吗?另外,你知道冒犯的
header是什么吗? -
另一个原因:您不止一次发送输出。无论如何,我们需要代码来审查
-
在此错误之前您是否看到模板的任何部分,如果是,则模板已被回显。
-
插件有好几个文件,这里就不放代码了。我不知道是什么文件导致了这个错误......
-
@sheikh-heera 不,没有模板输出。此错误发生在管理面板中。
标签: php wordpress session http-headers