3

管理パネルにログインしようとすると、このエラーが発生します。私はそれを理解することができません。

Warning: Cannot modify header information - headers already sent by (output started at /home/xxxxxx/public_html/wordpress/wp-config.php:1) in /home/xxxxxx/public_html/wordpress/wp-includes/pluggable.php on line 881

pluggable.php 881:

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);
}
endif;

最新バージョンのワードプレス 3.4.2 を使用しています。私のサイトは正常に動作しているようですが、エラーによりログイン ページにアクセスできません。つまり、この問題を引き起こしたと思われるプラグイン (dbc バックアップ 2) をまったく管理したり、アンインストールしたりできません。HTML キット ツールを使用して wp.config ファイルを何百回もチェックしましたが、ファイルの先頭にも末尾にも空白が表示されていません。私は持っている:

  1. HTML-Kit ツールを使用して wp-config ファイルの空白をチェックしました
  2. 新しい新鮮なwp-configファイルをダウンロードして挿入しました
  3. 名前を変更してプラグインディレクトリを無効にしました

...そしてエラーはまだ残っています

私が試してみなければならない唯一のことは、次のコードを wp-config.php ファイルに挿入することでこの問題を解決したと誰かがワードプレス フォーラムに投稿したこのコードです。

    <?
//dont use header function in wordpress-wp_signup.php
global $domain;
global $path;
//change urlnew variable as per requirment
$urlnew = "http://".$domain.$path."/wp-admin/admin.php;

echo "<script>";
echo "location = '$urlnew';";
echo "</script>";
echo $urlnew;
?>

html や php に詳しくなく、このコードがどのように機能するかを正確に理解していないため、コードを追加することに消極的です。より良い提案はありますか?


テーマの function.php ファイルは次のように終了します。コードを正確にどこに挿入すればよいですか?:

// include custom widget

$temp_root = get_root_directory('include/plugin/custom-widget/custom-blog-widget.php');

include_once($temp_root . 'include/plugin/custom-widget/custom-blog-widget.php'); 

$temp_root = get_root_directory('include/plugin/custom-widget/custom-port-widget.php');

include_once($temp_root . 'include/plugin/custom-widget/custom-port-widget.php'); 

$temp_root = get_root_directory('include/plugin/custom-widget/custom-port-widget-2.php');

include_once($temp_root . 'include/plugin/custom-widget/custom-port-widget-2.php'); 

$temp_root = get_root_directory('include/plugin/custom-widget/popular-post-widget.php');

include_once($temp_root . 'include/plugin/custom-widget/popular-post-widget.php'); 

$temp_root = get_root_directory('include/plugin/custom-widget/contact-widget.php');

include_once($temp_root . 'include/plugin/custom-widget/contact-widget.php'); 

$temp_root = get_root_directory('include/plugin/custom-widget/flickr-widget.php');

include_once($temp_root . 'include/plugin/custom-widget/flickr-widget.php'); 

$temp_root = get_root_directory('include/plugin/custom-widget/twitter-widget.php');

include_once($temp_root . 'include/plugin/custom-widget/twitter-widget.php');



// get the path for the file ( to support child theme )

function get_root_directory( $path ){

    if( file_exists( STYLESHEETPATH . '/' . $path ) ){

        return STYLESHEETPATH . '/';

    }else{

        return TEMPLATEPATH . '/';

    }

}

?>
4

3 に答える 3

5

現在のテーマ ディレクトリに functions.php ファイルがある場合は、以下のように functions.php ファイルに追加します。

//allow redirection, even if your theme starts to send output to the browser
add_action('init', 'clean_output_buffer');
function clean_output_buffer() {
        ob_start();
}

BOM の削除方法

BOM を削除するには、無料の 16 進エディタであるフリーウェア ユーティリティ XVI32 を使用することを Lafontaine 氏は提案しています。エディターはインストールされません。ZIP から直接 EXE ファイルを実行できます。プロセスは簡単です。「影響を受ける」PHP ファイル (私の場合は wp_config.php) を XVI32 にドラッグするだけで、きれいなバイトグリッドで開きます。次に、ファイルの最初の 3 バイトが "" であり、その後に php タグが続くことがわかります。

その場合は、各文字を順番に選択して削除する必要があります (Del キーを押します)。その後、ファイルを保存 (Ctrl+S) すると、先頭の BOM がないだけで、以前とまったく同じになります。

完全な記事リンク: http://blog.scribz.net/2010/12/windows-live-writer-wordpress-unicode-bom-error/

于 2012-09-23T11:16:41.520 に答える
4

これはワードプレスで非常に一般的な問題です。これを追加してください:

<?php ob_start(); ?>

ページの上部にあります。ハッピーコーディング!!

于 2012-09-24T06:47:45.053 に答える
0

これは、他のアプリケーションで発生した問題と似ています。ページ出力のどこかに文字が表示されていますか? バイト オーダー マーカーに問題がある可能性があります。http://en.wikipedia.org/wiki/Byte_order_markこれらはファイルのエンコーディングに依存します。この問題にどのように対処したか正確には覚えていませんが、ファイルを UTF-8 で保存してみてください。または、ファイルが ANSI であることを何らかの方法で Web サーバーに伝えますか?

于 2012-09-24T03:13:26.520 に答える