0
<?php
include 'conexao.php';
include 'acoes.php';
$sql = mysql_query("select nome, nota from aluno");
$a = 0;
while ($string = mysql_fetch_array($sql))
{
if ($a == 0)
{
$data = '<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">';
$data .= '<?xml version=\'1.0\' encoding=\'UTF-8\'?>';
$data .= '<urlset>';
}
$data .= '<url>';
$data .= '<loc>http://www.escola.com.br/' . removerosAcentos($string['nome']);
$data .= $string['nota'] . '</loc>';
$data .= '<changefreq>weekly</changefreq>';
$data .= '</url>';
$a += 1;
if ($a >= 45000)
{
$data .= '</urlset>';
$a = 0;
$nome_arquivo = uniqid();
header('Content-disposition: attachment; filename="' . $nome_arquivo . '.xml"');
header('Content-type: "text/xml"; charset="utf8"');
readfile($nome_arquivo . '.xml');
}
}
?>
文件中的数据卡在变量$的数据,只需要使用它的数据插入信息的XML网站地图PHP的MySQL拆分45000
如何通过创建网站地图的代码继续45000点的记录每个站点地图(sitemap1.xml,sitemap2.xml)
谁能帮助?
'45.000'到PHP是一个小数,使用'45000'。查看分页查询。你也最好使用'> ='你的'=='可能永远不会发生。 – chris85
已更改代码。谢谢! – sysrq