网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

如何统一one.asp多项目、函数库、类库的版本-创新互联

如何统一one.asp多项目、函数库、类库的版本?相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。

成都创新互联客户idc服务中心,提供成都移动机房托管、成都服务器、成都主机托管、成都双线服务器等业务的一站式服务。通过各地的服务中心,我们向成都用户提供优质廉价的产品以及开放、透明、稳定、高性价比的服务,资深网络工程师在机房提供7*24小时标准级技术保障。

举个简单的应用场景,开发一个小的API系统,支持 XML、JSON输出。区别是 基础版(dev/dev.asp)只支持 Access,VIP版本(dev/vip.asp)支持 Access + SQL Server。这样VIP版本就需要在现在的基础上 增加 sqlserver的支持,增加额外的 配置项。开发过程只需要 按正常开发即可。

如何统一one.asp多项目、函数库、类库的版本

开发完毕后,通过 one.asp 打包成 index.asp 和 vip.asp 两个版本,整套程序都是一个独立的文件。

如何统一one.asp多项目、函数库、类库的版本

下图演示了 解析过程:

如何统一one.asp多项目、函数库、类库的版本

完整的测试代码 可以 访问:oneasp.rar 下载

核心代码 如下:

' ====================================================
' 类名:One
' 作者:mqycn
' 博客:http://www.miaoqiyuan.cn
' 源码:http://www.miaoqiyuan.cn/p/one-php
' 说明:多项目 函数库、类库 统一为一个版本的方法
' ====================================================
Class OneAsp
  Private FSO
  Private Root
   
  Private Sub Class_Initialize()
    Set FSO = Server.CreateObject("Scripting.FileSystemObject")
  End Sub
   
  Private Sub Class_Terminate()
    Set FSO = Nothing
  End Sub
   
  Public Function Run(ByVal sourceFile, ByVal saveFile)
    Run = "
Input:" & sourceFile & "
Result:" & Save(saveFile, Include(sourceFile)) End Function Public Function Include(ByVal path) Dim tmpPath, tmpItem, arrPath, index tmpPath = "" arrPath = Split(path, "/") For index = 0 To UBound(arrPath) - 1 tmpItem = arrPath(index) tmpPath = tmpPath & tmpItem & "/" Next Include = Parse(tmpPath, arrPath(UBound(arrPath))) End Function Private Function Parse(ByVal root, ByVal fileName) Call SetRoot(root) Dim html html = OpenRead(fileName) Dim preg, pregResult Set preg = New Regexp preg.pattern = "" preg.global = True preg.ignorecase = True Dim htmlInclude Set pregResult = preg.execute(html) For Each htmlInclude In pregResult html = Replace(html, htmlInclude, Include(root & htmlInclude.submatches(0))) Next Parse = "<% '" & root & fileName & " Start %" & ">" & vbCrLf & html & vbCrLf & "<% '" & root & fileName & " End %" & ">" & vbCrLf End Function Private Function SetRoot(ByVal rootPath) If Right(rootPath, 1) <> "/" Then rootPath = rootPath & "/" Root = rootPath End Function Private Function RealPath(ByVal path) RealPath = Server.Mappath(Root & path) End Function Private Function OpenRead(ByVal path) Dim txtFile Set txtFile = FSO.OpenTextFile(RealPath(path)) OpenRead = txtFile.ReadAll() txtFile.close On Error GoTo 0 End Function Public Function Save(ByVal path, ByVal body) Dim txtFile Set txtFile = FSO.CreateTextFile(Server.Mappath(path)) txtFile.write body txtFile.close Set txtFile = Nothing Save = path End Function End Class

本文标题:如何统一one.asp多项目、函数库、类库的版本-创新互联
文章地址:http://bjjierui.cn/article/gishc.html

其他资讯