asp生成百度的xml代码

<%
nowtime=nowtime&"<updatetime>"&now()&"</updatetime>"&vbcrlf&""
'hour(now())
'minute(now())
'second(now()) 
set rshot=server.CreateObject("adodb.recordset")
sql="select * from 表名 order by id asc"
rshot.open sql,conn,1,1
if not (rshot.eof and rshot.bof) then
i=0
do while not rshot.eof

b=b&"<item>"&vbcrlf&""
b=b&"<link>http://www.mycodes.net/html/"&rshot("Classid")&"/"&rshot("ID")&".html</link>"&vbcrlf&""
b=b&"<title>"&rshot("Title")&"</title>"&vbcrlf&""
b=b&"<pubDate>"&rshot("Intime")&" "&hour(now())&":"&minute(now())&":"&second(now())&"</pubDate>"&vbcrlf&""
b=b&"<bbs:lastDate>"&rshot("Intime")&" 10:26:42</bbs:lastDate>"&vbcrlf&""
b=b&"<bbs:reply>"&rshot("Classid")&"</bbs:reply>"&vbcrlf&""
b=b&"<bbs:hit>"&rshot("Hits")&"</bbs:hit>"&vbcrlf&""
b=b&"<bbs:mainLen>"&rshot("ID")&"</bbs:mainLen>"&vbcrlf&""
b=b&"<bbs:boardid>"&rshot("Author")&"</bbs:boardid>"&vbcrlf&""
b=b&"<bbs:pick>1</bbs:pick>"&vbcrlf&""
b=b&"</item>"&vbcrlf&""
i=i+1
rshot.movenext
loop
end if
rshot.close
set rshot=nothing

xmlfile=server.mappath("sitemap_baidu.xml")
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile(xmlfile,True)
MyFile.WriteLine("<?xml version=""1.0"" encoding=""GB2312"" ?>")
MyFile.WriteLine("<document xmlns:bbs=""http://www.baidu.com/search/bbs_sitemap.xsd"">")
MyFile.WriteLine("<webSite>http://www.mycodes.net/</webSite>")
MyFile.WriteLine("<webMaster>admin@mycodes.net</webMaster>")
MyFile.WriteLine("<updatePeri>12</updatePeri>")
MyFile.WriteLine nowtime
MyFile.WriteLine("<version>源码之家</version>")
MyFile.WriteLine b
MyFile.WriteLine("</document>")
MyFile.Close
response.Redirect("sitemap_baidu.xml")

%>

转载于:https://www.cnblogs.com/shltzl/p/3140871.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值