changefreq:页面内容更新频率。
    lastmod:页面最后修改时间
    loc:页面永久链接地址
    priority:相对于其他页面的优先权
    首先是准备php的环境,本代码是通过php运行的
    上代码
    [PHP] 纯文本查看 复制代码
    ?

    01
    02
    03
    04
    05
    06
    07
    08
    09
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    <?php
    $dom= newDOMDocument(“1.0”, “utf-8”);
    header(“Content-Type: text/xml”);
    $root= $dom->createElement(“urlset”);
    $dom->appendChild($root);
    for($i= 0; $i<= 998; $i++) {
    $track= $dom->createElement(“url”);
    $root->appendChild($track);
    $loc= $dom->createElement(“loc”);
    $track->appendChild($loc);
    $lastmod= $dom->createElement(“lastmod”);
    $track->appendChild($lastmod);
    $changefreq= $dom->createElement(“changefreq”);
    $track->appendChild($changefreq);
    $priority= $dom->createElement(“priority”);
    $track->appendChild($priority);
    $text= $dom->createTextNode(‘http://www.baidu.com/‘. (mt_rand(1,20)) . ($i+1) . ‘.html’);
    $loc->appendChild($text);
    $date= date(“Y-m-d”, strtotime(‘-‘. rand(0,10) . ‘day’));
    $text= $dom->createTextNode($date);
    $lastmod->appendChild($text);
    $text= $dom->createTextNode(daily);
    $changefreq->appendChild($text);
    $text= $dom->createTextNode(0.8);
    $priority->appendChild($text);
    }
    $dom->save(“sitemap.xml”);
    exit;

    这样就可以在你的网站根目录下生成sitemap.xml文件
    seo优化搬砖吾爱 - 图1
    百度站长的抓取频率自己设置,然后吧这个链接加入到你的宝塔计划任务定时访问url
    这样他就会自动帮你更新了,这个当然你也可以自己修改一下自己需要的参数或URL
    具体方法请参考百度,已经与百度达成了深度合作,问他都会答你的