收 藏 投 稿 繁 体 RSS 
站长吧-中国站长学习与交流的网站
首 页 运 营 学 院 建 站 论 坛
Web master8.net  
 网站运营  
  欢迎在本站发布信息,在线投递稿件请点这里。编辑QQ:4908220,欢迎联系交流。
业界动态 创业故事 推广研究 策划盈利 电子商务 企业平台
  站长工具
SEO查询 Whois查询 Pr查询 域名查询 IP查询 网页编辑器
 建站服务  
  如有建站意向,请尽快联系我们,以便安排时间... 建站服务 QQ4908220 QQ:4908220
作品展示 服务范围 服务流程 服务报价 联系方式 付款方式
文章正文  » 您的当前位置: 首页 >> 学院 >> 程序开发 >> ASP
利用Asp生成整站静态
  来源:互联网 | 时间:2007-04-15 | 浏览:   相关评论 | 报告错误 | 发布文章
【字号: | | 】 【背景色 杏仁黄 秋叶褐 胭脂红 芥末绿 天蓝 雪青 灰 银河白(默认色)
很多人在网说要全站转静态程序但是大多数都没结果的,所以小妹妹凭着一知半解的写了这个代码希望有了解 asp转静态技术 交流一下

QUOTE:
<%
On Error Resume Next
Server.ScriptTimeOut=9999999
Function getHTTPPage(Path)
t = GetBody(Path)
getHTTPPage=BytesToBstr(t,"GB2312")
End function
Function GetBody(url)
on error resume next
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", url, False, "", ""
.Send
GetBody = .ResponseBody
End With
Set Retrieval = Nothing
End Function
Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
Function Newstring(wstr,strng)
Newstring=Instr(lcase(wstr),lcase(strng))
if Newstring<=0 then Newstring=Len(wstr)
End Function
%>

xmlhttp.asp

QUOTE:
<%
url="co.asp?id=2,"
wb_cx=PcMane(url)
IF wb_cx<>"" THEN
RESPONSE.Write("开始转换静态过程")
fso_wstr=split(wb_cx,",")
for i=0 to UBound(fso_wstr)-1
qman_html_min=(thhs(thhs(fso_wstr(i),"?","~"),".asp","")&".html")
qman_html_min=getHTTPPage(http&fso_wstr(i))
for j=0 to UBound(fso_wstr)-1
qman_html_min=thhs(qman_html_min,fso_wstr(j),thhs(thhs(fso_wstr(j),"?","~"),".asp","")&".html")
qman_html_min=thhs(qman_html_min,".html&",".html?")
next
Set fso = Server.CreateObject("Scripting.FileSystemObject")
FilePath = Server.MapPath(qman_html_url)
Set fout = fso.CreateTextFile(FilePath)
qman_html_min=qman_html_min&""
fout.WriteLine qman_html_min
NEXT
else
response.Write("没有成功")
END IF



function PcMane(url)
dim arrID
arrID =FormateOrderBy(arrID&url)
http="http://www.gong-z.com/"
DG_Split=Split(arrID,",")
for i=0 to Ubound(DG_Split)-1
DG_href="<(a href=)[\w]. ?>"
DG_wstr_1=DG_wstr_1&stripHTML(">",stripHTML(" tmp = Split(OrderByText,",")
For i=0 To Ubound(tmp)-1
For j=i 1 To Ubound(tmp)
If UCase(Trim(tmp(i)))=UCase(Trim(tmp(j))) Then
tmp(j)=""
End If
Next
Next
tmp2=""
For i=0 To Ubound(tmp)
If tmp(i)<>""Then tmp2=tmp2&tmp(i)&","
Next
FormateOrderBy=Left(tmp2,Len(tmp2))
End Function

'正则函数
Function RegExpTest(patrn, strng)
Dim regEx, Match, Matches
Set regEx = New RegExp
regEx.Pattern = patrn
regEx.IgnoreCase = True
regEx.Global = True
Set Matches = regEx.Execute(strng)
For Each Match in Matches
RetStr = RetStr & Match.Value&","
Next
RegExpTest = RetStr
End Function
Function stripHTML(patrn,strHTML)
Dim objRegExp, strOutput
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern =patrn
strOutput = objRegExp.Replace(strHTML, "")
stripHTML = strOutput
Set objRegExp = Nothing
End Function
%>
master8
  • 上一篇:给钱多排名就靠前 搜索引擎未必可靠
  • 下一篇:Skype出台海外赔偿方案

  • 我要投稿  打印本文  推荐本文  加入收藏  返回顶部  关闭窗口
    搜模板(www.somoban.com) 原创网站模板交易平台
    阿里妈妈再掀疯狂采购风,网站广告位严重告急,急召天下站长
    基于PHP+MySQL的整站、模块、插件开发等或者按需求实现相应功能;
基于各PHP主流建站系统CMS,BBS,BLOG等的模板定制,完全手写代码;
整站数据迁移或备份恢复;网页代码优化、重构;整站常规SEO优化;网站技术支持;
点击了解详情...
    站长论坛
    • 验证码: