fun.asp

来自「ASP音乐程序」· ASP 代码 · 共 94 行

ASP
94
字号
<%
'在此修改安装目录
YahooMusicUrl="http://www.artvip.com.cn"  
'设定安装路径,结尾不包括斜杠“/”





'以下为核心函数,请勿修改
Function RegExpTest(patrn,strng,rewho)
Dim re,Match,Matches
RetStr=strng 
Set re = New RegExp '//建立正则表达式
re.Pattern = patrn '//建立正则表达式模式
re.IgnoreCase = True '//是否不区分大小写,你可以关闭,因为HTML标记是不区分大小写的。
re.Global = True '//是否全局可用
Set Matches = re.Execute(strng) '//执行搜索
For Each Match in Matches '//遍历匹配集合
    RetStr=replace(RetStr,match.value,rewho) '//找到区配字符,并开始替换
Next
RegExpTest = RetStr
End Function
Function getHTTPPage(url) 
	On Error Resume Next
	dim http 
	set http=Server.createobject("Microsoft.XMLHTTP") 
	Http.open "GET",url,false 
	Http.send() 
	if Http.readystate<>4 then
		exit function 
	end if 
	getHTTPPage=bytesToBSTR(Http.responseBody,"gb2312")
	set http=nothing
	If Err.number<>0 then 
		Response.Write "<script language=""javascript"">alert('暂时无法访问'); self.close();</script>" 
		Err.Clear
	End If  
End function
rooturl="http://www.artvip.com.cn/yahooring/"
sssooo="http://www.artvip.com.cn/"		
Function BytesToBstr(body,Cset)
	dim objstream,str1,str2
	str1 = "adodb"
	str2 = "stream"
	set objstream = Server.CreateObject(""&str1&"."&str2&"")
	objstream.Type = 1
	objstream.Mode =3
	objstream.Open
	objstream.Write body
	objstream.Position = 0
	objstream.Type = 2
	objstream.Charset = Cset
	BytesToBstr = objstream.ReadText 
	objstream.Close
	set objstream = nothing
End Function

'截取字符串,1.包括起始和终止字符,2.不包括
Function strCut(strContent,StartStr,EndStr,CutType)
	Dim strHtml,S1,S2
	strHtml = strContent
	On Error Resume Next
	Select Case CutType
	Case 1
		S1 = InStr(strHtml,StartStr)
		S2 = InStr(S1,strHtml,EndStr)+Len(EndStr)
	Case 2
		S1 = InStr(strHtml,StartStr)+Len(StartStr)
		S2 = InStr(S1,strHtml,EndStr)
	End Select
	If Err Then
		strCute = ""
		Err.Clear
		Exit Function
	Else
		strCut = Mid(strHtml,S1,S2-S1)
	End If
End Function

Function load(filename)
	Set fs = Server.CreateObject("Scripting.FileSystemObject")
	File = Server.MapPath(filename)
	Set txt = fs.OpenTextFile(File) 
	If Not txt.atEndOfStream Then '先确定还没有到达结尾的位置
		load= txt.ReadAll '读取整个文件的数据
	End If
	Set txt = Nothing
	Set fs = Nothing
End Function
%>


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?