Giter Site home page Giter Site logo

php-sitemap's Introduction

php-sitemap

PHP 网站地图 Sitemap工具类

Sitemap 可方便网站管理员通知搜索引擎他们网站上有哪些可供抓取的网页。 最简单的 Sitemap 形式,就是XML 文件,在其中列出网站中的网址以及关于每个网址的其他元数据(上次更新的时间、更改的频率以及相对于网站上其他网址的重要程度为何等), 以便搜索引擎可以更加智能地抓取网站。

安装

composer require liliuwei/php-sitemap

用法示例

<?php
$site = new \liliuwei\Sitemap();
$cate = [
    1 => '男装',
    2 => '女装'
];

$article_list = [
    1 => '怎么穿衣服有气质  教你身材不好也可以穿出女神范',
    2 => '秋冬穿衣搭配图片  秋冬季内搭和大衣要如何搭配呢'
];
foreach ($cate as $key => $value) {
    $site->AddItem('http://www.youqunaya.com/list.html?cid=' . $key, 1);
}

foreach ($article_list as $key => $value) {
    $site->AddItem('http://www.youqunaya.com/article_list.html?id=' . $key, 1);
}
//$site->AddItem();支持多次调用
$site->SaveToFile('sitemap.xml');

php-sitemap's People

Contributors

liliuwei avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.