如何做一个检索结果带链接的检索?
<%
data=request.form("search_data")
' 从FORM变量集得到要查询的文件名称所要包含的字符串
p=search_folder(data,"http://jack/cgi-bin","c:\intels\wwwroot\cgi-bin")
' 调用函数查询目标查询目录下的所有子目录(所有子树),方法:search_folder(要查询的字符串,查询目标的虚拟绝对路径,查询目标的真实绝对路径)
%>
<script language="vbscript" RUNAT=SERVER>
function search_folder(search_data,v_path,c_path)
dim file_system,cur_folder,sub_folders,sub_files
' 目录检索函数
if not isempty(search_data) and len(search_data)>0 then
' 确定查询字符串有效非空
set file_system=createobject("scripting.filesystemobject")
' 建立文件系统对象
set cur_folder=file_system.getfolder(c_path)
' 建立建立当前目录对象
set sub_folders=cur_folder.subfolders
' 建立当前目录的子目录对象集合
for each each_sub_folder in sub_folders
' 对子目录集合进行遍历
if each_sub_folder.attributes=16 then
' 确定子目录的属性为普通子目录
sub_v_path=v_path&"/"&each_sub_folder.name
sub_c_path=c_path&""&each_sub_folder.name
'得到当前的子虚拟绝对路径与真实绝对路径,默认子目录与子虚拟目录级别名称完全相同
p=search_file(search_data,sub_v_path,sub_c_path)
' 调用文件检索函数对当前子目录下的文件进行字符串匹配检索
p=search_folder(search_data,sub_v_path,sub_c_path)
' 递归检索当前子目录的下一级目录
end if
next
set each_sub_folder=nothing
set sub_folders=nothing
set cur_folder=nothing
set file_system=nothing
' 清空
end if
end function
--------------------------------------------------------------------------------------------------------------------------------
function search_file(search_data,v_path,c_path)
dim file_system,sub_files,sub_file_v_path,sub_out_v_path
' 文件匹配检索函数
if not isempty(c_path) then
' 确认路径不为空
set file_system=createobject("scripting.filesystemobject")
set cur_folder=file_system.getfolder(c_path)
set sub_files=cur_folder.files
' 建立检索目录下的文件对象集合
for each each_file in sub_files
' 遍历文件对象集合
if instr(each_file.name,search_data)<>0 then
' 匹配字符串与文件名
sub_file_v_path=v_path&"/"&each_file.name
' 建立可用链接,输出匹配文件
sub_out_v_path=Replace(sub_file_v_path," ","%20")
' 替换路径及文件名中的空格,以便系统确定路径
response.write("<p><a
href="&sub_out_v_path&">"&sub_file_v_path&"</a>")
end if
next
set sub_out_v_path=nothing
set sub_file_v_path=nothing
set each_file=nothing
set sub_files=nothing
set file_system=nothing
end if
end function
</script>
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
P70系列延期,华为新旗舰将在下月发布
3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。
而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?
根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。
更新日志
- 纯音入心系列纯音乐《中央民族乐团-古筝传奇》1CD[MP3][253.1MB]
- 江玲.1989-这样你才爱我,是吗?【新作有声】【WAV+CUE】
- 郭美美.2010-我是郭美美【华纳】【WAV+CUE】
- 黄心懋1991-轻忧郁【滚石】【WAV+CUE】
- 群星.2000-大地金曲世纪回顾2CD【大地】【WAV+CUE】
- 王菲.1996-浮躁(2024环球MQA-UHQCD限量版)【环球】【WAV+CUE】
- 群星.2022-传家电视剧原声带【东阳欢娱】【FLAC分轨】
- 《摇滚教父 伍佰黄金精选 2CD》 [WAV+CUE][1GB]
- 《凤凰传奇 我从草原来》[WAV/分轨][400MB]
- 《叶倩文 真心真意过一生》[WAV+CUE][400MB]
- 潘越云.1985-世间女子(滚石25周年经典复刻版)【滚石】【WAV+CUE】
- 陈柏宇.2009-CANT.BE.HALF【SONY】【WAV+CUE】
- 李明依.1989-小女生【滚石】【WAV+CUE】
- 《李荣浩 新时代创作新人王》[WAV分轨][310MB]
- 《黑鸭子与马头琴 史上最动听草原音乐》[WAV+CUE][320MB]