와의 sitemap.xml하는 것입니다변환 TXT 포함 I 텍스트 데이터베이스가있는 것으로 추측 PHP
http://example.com,monthly,0.3
http://example.com/one,daily,0.5
http://example.com/two,weekly,0,8
내가 sitemap.xml의 내 텍스트 데이터베이스로 변환하고 싶습니다. 나는이 부분을 추가 할 수 없습니다 나는이 코드를 시도
$fp = fopen('./database.txt', 'r');
$xml = new XMLWriter;
$xml->openURI('./sitemap.xml');
$xml->setIndent(true);
$xml->startElement('urlset');
while ($line = fgetcsv($fp)) {
if (count($line) < 4) continue;
$xml->startElement('url');
$xml->writeElement('loc', $line[0]);
$xml->writeElement('changefreq', $line[1]);
$xml->writeElement('priority', $line[2]);
echo $xliff->getDocument();
$xml->endElement();
}
$xml->endElement();
, ...
<?xml version="1.0" encoding="UTF-8"?>
<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">