gpt4 book ai didi

仅允许在文档开头的 XML 声明

转载 作者:行者123 更新时间:2023-12-03 18:12:01 33 4
gpt4 key购买 nike

今天我的博客提要显示错误:

This page contains the following errors:

error on line 2 at column 6: XML declaration allowed only at the start of the document

Below is a rendering of the page up to the first error



我的博客供稿: http://feeds.feedburner.com/klassicblog

我的博客: http://blog.klassicweb.com

最佳答案

这是我找到的解决方案
首先,您在 wordpress 根目录中创建一个包含以下内容的 php 文件 (whitespacefix.php)。

<?php
function ___wejns_wp_whitespace_fix($input) {
$allowed = false;
$found = false;
foreach (headers_list() as $header) {
if (preg_match("/^content-type:\\s+(text\\/|application\\/((xhtml|atom|rss)\\+xml|xml))/i", $header)) {
$allowed = true;
}
if (preg_match("/^content-type:\\s+/i", $header)) {
$found = true;
}
}
if ($allowed || !$found) {
return preg_replace("/\\A\\s*/m", "", $input);
} else {
return $input;
}
}
ob_start("___wejns_wp_whitespace_fix");
?>

然后打开 index.php 文件并在 <?php 后面添加以下行标签
include('whitespacefix.php');

引用自 here

关于仅允许在文档开头的 XML 声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14685893/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com