我想知道如何使用PHP和MySQL创建网站地图,您是否知道任何网站地图设计示例?
我在我的网站上使用这个,效果很好,你可以将Google的网站管理员工具指向"this_file.php",它会发挥奇效!
<?php header("Content-type: text/xml"); echo'<?xml version=\'1.0\' encoding=\'UTF-8\'?>'; echo' <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">';
include '../include.php'; $sql = mysql_query("select blah from bleh");
while ($string = mysql_fetch_array($sql)){?> <url> <loc>http://www.domain.com/dir/<?echo $string['value'];?>/index.php</loc> <changefreq>weekly</changefreq> </url> <?php } ?> </urlset>
sitemap.xml
?还是为用户创建一个查看的地图?如果是后者,这些东西(大多数)在上个世纪就过时了。 - ceejayoz