/**
*notes:网站地图
*/
function Sitemap() {
vendor('Sitemap.sitemap');
$sitemap = new Sitemap('http://www.网址.com/'); //网址
$sitemap->addItem('/appnews', '1.0', 'monthly', 'Today');
$res = M('Article')->where(['status'=>1])->field('id,created_at')->order('id asc')->select();
foreach ($res as $v){
$sitemap->addItem('/appnews/'.$v['id'].'.html', '0.8', 'monthly', 'Today');//新闻栏目 可替换月日
}
$resu = M('Case')->where(['status'=>1,'is_show'=>1])->field('id,created_at')->order('id asc')->select();
$sitemap->addItem('/appcase', '1.0', 'monthly', 'Today');
foreach ($resu as $vv){
$sitemap->addItem('/appcase/'.$vv['id'].'.html', '0.8', 'monthly', 'Today');//实例栏目
}
$pro = M('Project')->where(['is_tui' => 1,'cate_id' => 1])->select();
$sitemap->addItem('/appsolve', '1.0', 'monthly', 'Today');
foreach ($pro as $k){
$sitemap->addItem('/appsolve/'.$k['id'].'.html', '0.8', 'monthly', 'Today');//推荐栏目
}
$sitemap->addItem('/appabout', '1.0', 'monthly', 'Today');//关于我们
$sitemap->endSitemap();
$sitemap->setXmlFile("/sitemap");//根目录下生成文件
}