嘗試登錄到管理面板時,我遇到了此錯誤。我無法理解它。無法修改Wordpress中的標題信息錯誤
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;
我使用的是最新版本的WordPress的3.4.2。我的網站似乎工作得很好,但錯誤阻止我進入登錄頁面,這意味着我無法管理或卸載插件(dbc backup 2),這似乎觸發了此問題。我使用HTML-kit工具檢查了wp.config文件的時間,並且在開始和結束時沒有可見的空白。我有:
- 經過從WP-config文件中的空格與HTML-Kit工具
- 下載並重新命名它
插入新的新鮮的wp-config文件
我唯一需要嘗試的是此代碼在wordpress論壇上發佈,聲稱他已通過將以下代碼插入以解決此問題在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 . '/';
}
}
?>
刪除'<?'之前的空格,它應該可以工作。 – Gumbo
正如我所提到的,記事本++或HTML套件工具編輯器沒有前導空格,並保存在ANSI中。爲了進一步運行它,我甚至再次下載了文件,只填寫了必要的部分。 – user1692154