asp变成google网站地图的xml源代码
发布时间:2022-04-11 13:59:27 所属栏目:Asp教程 来源:互联网
导读:% Response.Buffer = True With Response .Expires = -1 .AddHeader Pragma,no-cache .AddHeader cache-ctrol,no-cache End With % % Server.ScriptTimeout=50000 Dim str,objStream str = ?xml version=1.0 encoding=UTF-8? vbcrlf str = str urlset xmlns=h
|
<% Response.Buffer = True With Response .Expires = -1 .AddHeader "Pragma","no-cache" .AddHeader "cache-ctrol","no-cache" End With %> <% Server.ScriptTimeout=50000 Dim str,objStream str = "<?xml version='1.0' encoding='UTF-8'?>" & vbcrlf str = str & "<urlset xmlns='http://www.google.com/schemas/sitemap/0.84'>" & vbcrlf str = str & getfilelink & vbcrlf str = str & "</urlset>" & vbcrlf Set objStream = Server.CreateObject("ADODB.Stream") With objStream .Open .Charset = "UTF-8" .Position = objStream.Size .WriteText=str .SaveToFile server.mappath("sitemap.xml"),2 .Close End With Set objStream = Nothing If Not Err Then Response.Redirect("sitemap.xml") Response.End End If Function getfilelink() SQL="SELECT * FROM 表名 ORDER BY id DESC" Dim RS Set RS=Server.CreateObject("ADODB.RecordSet") RS.Open SQL,Conn,1,1 IF RS.EOF AND RS.BOF Then Response.Write("<url></url>") Else Do While NOT RS.EOF Y=year(RS("intime")) if len(month(RS("intime")))=1 then M=0&month(RS("intime")) else M=month(RS("intime")) end if if len(day(RS("intime")))=1 then D=0&day(RS("intime")) else D=day(RS("intime")) end if getfilelink = getfilelink & "<url><loc>http://www.mycodes.net/html/"&RS("Classid")&"/"&RS("ID")&".Html</loc><lastmod>"&Y&"-"&M&"-"&D&"</lastmod><changefreq>"&RS("Title")&"</changefreq><priority>1.0</priority></url>" RS.MoveNext Loop End IF RS.Close Set RS=Nothing Conn.Close Set Conn=Nothing End Function %> (编辑:衢州站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 东易日盛2019年亏损1.8亿元 受宏观经济及市场需求下降影响较
- iPhone 8 iPhone 8 Plus以及iPhone X就是今年的三款新iPhon
- 在环保“去粗取精”的洗牌变革中,洞悉2020家居业3大变化
- iPhone设置1970变砖问题依旧 iPhone设置1970还能再变砖问题
- 家居建材的零售流量大幅消减,问题出在哪里?经销商该如何面
- AI智净,探索纯物理天然好水 | COLMO D1800全新上市
- 西南打侵权打假冒自律工作组成立大会顺利召开
- apple watch 2怎么玩精灵宝可梦go 苹果手表2怎么玩精灵宝可
- .NET IoC模式依赖反转(DIP)、控制反转(Ioc)、依赖注入(DI)
- iPhone 6真机外观

