asp批量查询关键词问题
我前行是 2019-04-15 12:29:16 求助大神。批量关键词查询问题。发现只能查询第一个。代码如下。感觉有毒
<%
set fs=server.createobject("scripting.filesystemobject")
file=server.mappath("gjc.txt")
set txt=fs.opentextfile(file,1,true)
if not txt.atendofstream then
line=txt.ReadAll
end if
Response.Write(gjc("----熊猫------",line))'本地读入txt然后用函数分割。查询是否有关键词。为什么老是不行。大家可以复制代码试一下
Function gjc(a,b)
'a是分享来源文本
'读入源文件
b=split(b,chr("13"))
for i=0 to ubound(b)
q=b(i)
Response.Write ("源文本:"&i& "--搜索文本:"&q&"---搜索文本出现位置:"&instr(a,q)&" <br>")
if instr(a,q) > 0 then
gjc="找到"
exit for
else
gjc="没找到"
end if
next
end function
%>