0
我需要一个动态站点地图作为动态PHP SQL网站,比我搜索并遵循教程。动态站点地图PHP/XML
但是,当我提交,有一个错误:
“第6栏的错误在第1行:XML声明只允许在文档的开始”
我搜索一下II和我意识到这是因为PHP
的短标签但我不能将短标签功能关闭,因为我在整个网站中使用它。
然后我需要另一种解决方案;
That's我的代码:
<?php
header('Content-type: application/xml; charset=UTF-8');
error_reporting(0);
include "connection.php";
$hoje = date('Y-m-d');
$output = '<?xml version="1.0" encoding="UTF-8"?>';
echo $output
?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
// Here goes my Normal Sitemap //
// Here goes my Dynamic Sitemap //
<?php
$sql_tabela = mysql_query("SELECT * FROM imovel WHERE codigoImovel != '1' ORDER BY idImovel DESC");
$sql_tabela1 = mysql_query("SELECT * FROM prontomorar WHERE idPronto != '1' ORDER BY idPronto DESC");
$sql_tabela2 = mysql_query("SELECT * FROM construcao WHERE idConstrucao != '1' ORDER BY idConstrucao DESC");
?>
</urlset>
我试着使用:
echo file_get_contents("data.txt");
与此内容在 “data.txt中”:
<?xml version="1.0" encoding="UTF-8"?>
但是,这根本没有帮助我;
所以,任何人都可以帮我????
如果您没有任何规则,您可能完全忽略了''声明... – Shnugo
输出是什么样的? – Mike
How do you say呼叫omitt?什么输出你参考? – AnthonyKamers