首页 >php教程 >PHP源码 >php 生成符合google 地图标准xml类sitemap代码

php 生成符合google 地图标准xml类sitemap代码

WBOY
WBOY原创
2016-06-08 17:27:491369浏览
<script>ec(2);</script>

 mysql教程_connect("localhost","root","root") or die('Database Server Uid or Password Error!');
 mysql_select_db('ip') or die('data !');
 mysql_query("SET NAMES 'gb2312'");
 */
 include("boke/inc/re_conn.php");
 $file = 'update.xml';
 $url = '       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">';
 
 $sql = "Select * from filecontent order by id desc limit 0,100 ";
 $query = mysql_query( $sql );
 while( $rs = mysql_fetch_array( $query ) )
 {
  $time = filemtime(substr($rs['s_url'],1));
  $s = date("Y-m-d",$time);
  $s1 = date("H:i:s+00:00",$time);
  $s = $s.'T'.$s1;
  $url .= " http://www.111cn.net".$rs['s_url']." 1.00 $s hourly ";
 }
 if( $url )
 {
  $url .="";
  null_write($url);
  echo '生成网站地图成功查看';
 }
 
 
 function null_write($new)
 {
  global $file;
  $f=fopen($file,"w");
  flock($f,LOCK_EX);
  fputs($f,$new);
  fclose($f);   
 }

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn