使用php编写百度sitemap

在使用php想百度站长平台提交性感美女图片的数据可以使用下面的方法

public function  pc()
    {
//        $table_name = get_sites_table_name($this->site['id']);
$datas = get_site_data($this->site['id'], 1, 1000);//这里是获取http://www.renti199.com的站点内容
$datas = $datas['data'];
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"
>
');
foreach ($datas as $k => $v) {
$url = "http://".$this->site['domain'] . get_show_url($v);
echo '
            <url>
             <loc>' . $url . '</loc>
             <priority>0.5</priority>
             <lastmod>' . date("Y-m-d", time()) . '</lastmod>
             <changefreq>daily</changefreq>
            </url>
            ';
        }
echo "</urlset>";
    }

 

猜你喜欢

转载自yangjiyue.iteye.com/blog/2399756