查看: 1823|回复: 0

[问与答] asp 读取txt部分内容输出(问答百度知道的一个问题)

[复制链接]
xuanxiao 发表于 2018-10-18 11:57:41 | 显示全部楼层 |阅读模式
代码部分
  1. <%
  2. Public Function OpenFile(Fname)
  3. dim whichfile
  4. whichfile=server.mappath(Fname)
  5. Set fso = CreateObject("Scripting.FileSystemObject")
  6. if fso.fileExists(whichfile) then   
  7. Set txt = fso.OpenTextFile(whichfile,1,true)  
  8. if not txt.atendofstream then   
  9.   rline=txt.ReadAll
  10. else
  11. rline=""   
  12. end if
  13. OpenFile=rline
  14. txt.Close  
  15. end if
  16. Set fso = Nothing
  17. END Function

  18. dim txt:txt= openfile("domain.txt")
  19. dim m,txt_sub
  20. dim domain:domain=""

  21. txt=split(txt,vbcrlf)
  22. for m=0 to  ubound(txt)
  23. txt_sub=split(txt(m),"|")
  24. if instr(txt_sub(5),"goto")>0 then domain=domain&txt_sub(1)&","
  25. next
  26. response.Write domain
  27.   %>
复制代码
完整文件参考附件

demo.rar

719 Bytes, 下载次数: 29, 下载积分: 威望 1 个

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表

在线客服

售前咨询
售后咨询
服务热线
023-58418553
微信公众号