佳木斯湛栽影视文化发展公司

主頁 > 知識庫 > 文本搜索

文本搜索

熱門標(biāo)簽:服務(wù)器配置 科大訊飛語音識別系統(tǒng) Linux服務(wù)器 電子圍欄 阿里云 Mysql連接數(shù)設(shè)置 團(tuán)購網(wǎng)站 銀行業(yè)務(wù)
%
Head = "搜索"
SearchString = Request("SearchString")
count=0

'把當(dāng)前目錄的實(shí)際路徑轉(zhuǎn)換為虛擬路徑
Function UnMapPath( Path )
UnMapPath = Replace(Mid(Path, Len(Server.MapPath("/")) + 1), "\&;, "/")
End Function


Function SearchFile( f, s, title )
Set fo = fs.OpenTextFile(f)
content = fo.ReadAll'讀全部文本到content
fo.Close
SearchFile = InStr(1, content, S, vbTextCompare) > 0 '從第一個(gè)字符開始檢查content里面是否有S
If SearchFile Then'如果有,則提出文件TITLE存入變量
pos1 = InStr(1, content, "TITLE>", vbTextCompare)
pos2 = InStr(1, content, "/TITLE>", vbTextCompare)
title = ""
If pos1 > 0 And pos2 > 0 Then'取TITLE標(biāo)記中間的字符
title = Mid( content, pos1 + 7, pos2 - pos1 - 7 )
End If
End If
End Function

Function FileLink( f, title )
vPath = UnMapPath( f.Path )'取路徑
If title = "" Then title = f.Name'做鏈接
FileLink = "A HREF=""" vPath """>" title "/A>"
FileLink = "UL>·" FileLink "/UL>"
End Function

Sub SearchFolder( fd, s )
found = False
For each f In fd.Files
pos = InStrRev(f.Path, "." )
If pos > 0 Then
ext = Mid(f.Path, pos + 1 )
Else
ext = ""
End If
If LCase(ext) = "htm" Then'顯示擴(kuò)展名字為HTM的文件
If SearchFile( f, s, title ) Then
Response.Write FileLink(f, title)
count=count+1
' Response.Write cstr(count)
End If
End If
Next

For each sfd In fd.SubFolders
SearchFolder sfd, s
Next
End Sub
%>
html>

head>
meta http-equiv="Content-Type"
content="text/html; charset=gb_2312-80">
meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
title>%=Head%>/title>
/head>

body bgcolor="#FFFFFF">

h1>%=Head%>/h1>

hr>

form action="search.asp" method="Get">
p>請輸入欲搜索的內(nèi)容: input type="text"
size="20" name="SearchString" value="%=SearchString%>"> input
type="submit" value="搜索"> /p>
/form>
%
Set fs = Server.CreateObject("Scripting.FileSystemObject")
Set fd = fs.GetFolder( Server.MapPath("/") ) '設(shè)置開始搜索的路徑!

If SearchString > "" Then
Response.Write "H2>搜索font color=red>" SearchString "/font>結(jié)果如下:/H2>P>"
SearchFolder fd,SearchString
End If
%>
hr>
/body>
/html>

標(biāo)簽:廣元 大理 江蘇 衢州 棗莊 衡水 萍鄉(xiāng) 蚌埠

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《文本搜索》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    凤山县| 汝阳县| 抚远县| 祁阳县| 洪湖市| 土默特右旗| 西充县| 平邑县| 桐柏县| 清徐县| 大方县| 泰宁县| 葵青区| 武陟县| 洛南县| 虎林市| 泸西县| 保定市| 阿合奇县| 中西区| 平阴县| 南通市| 平舆县| 玉龙| 宁城县| 鄯善县| 赤壁市| 惠来县| 德阳市| 那坡县| 南岸区| 于田县| 商都县| 郴州市| 家居| 炉霍县| 科技| 普陀区| 肇庆市| 新和县| 板桥市|