Use php to write Baidu sitemap

 

When using php to submit data of sexy beauty pictures to Baidu webmaster platform , you can use the following method

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>";
    }

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326408447&siteId=291194637