이 기사는 주로 ASP 교체 및 원격 사진 저장에 대한 기능 코드를 공유합니다
ASP는 기능을 사용하여 원격 그림을 교체하고 저장하고, 사진을 자동으로 수집하고 추출하는 기능을 완성하고, 기능의 반복 사진을 자동으로 판단하고, 링크 경로를 지능적으로 분석하고, 상대 사진 주소로 변환하고 웹 사이트 디렉토리에 저장합니다. 지정. 우리는 배경 편집기에서 기능을 사용하면이 코드가 자동으로 사진을 업로드합니다. 동시에이 코드는 컬렉션 프로그램에서 중요한 처리 기능입니다.
- functionReplacesaverEmoteFile (Constr, Strinstalldir, StrChannelDir, Savetf, Tisturl)
- ifconst = $ false $ orconst = orstrinstalldir = orstrchanneldir = 그런 다음
- replacesaveremotefile = constr
- 종료 기능
- endif
- dimtempstr, tempstr2, tempstr3, re, matches, match, temppi, temparray, temparray2
- setre = newRegexp
- re.ignorecase = true
- re.global = true
- re.pattern =]>
- setMatches = re.Execute (constrs)
- foreachMatchInMatches
- iftempstr <>
- tempstr = tempstr & $ array $ & match.value
- 또 다른
- tempstr = match.value
- endif
- 다음
- iftempstr <>
- temparray = split (tempstr, $ array $)
- tempstr =
- fortempi = 0toubound (temparray)
- re.pattern = src/s*=/s*.+?/.
- setMatches = re.Execute (temparray (tempi))
- foreachMatchInMatches
- iftempstr <>
- tempstr = tempstr & $ array $ & match.value
- 또 다른
- tempstr = match.value
- endif
- 다음
- 다음
- endif
- iftempstr <>
- re.pattern = src/s*=/s*
- tempstr = re.replace (tempstr,)
- endif
- setMatches = 아무것도
- setre = 아무것도
- iftempstr = orisnull (tempst) = truethen
- replacesaveremotefile = constr
- 종료 기능
- endif
- tempstr = replace (tempstr ,,)
- tempstr = replace (tempstr, ',)
- tempstr = replace (tempstr ,,)
- DimRemoteFileUrl, SavePath, PathTemp, Dtnow, strfilename, strfiletype, arrsavefilename, rannum, arr_path
- dtnow = now ()
- ifsavetf = truethen
- SavePath = StrChannelDir &/& Year (Dtnow) 및 오른쪽 (0 & Month (Dtnow), 2) 및///
- 응답. 링크 경로 작성 : & savepath &
- arr_path = split (savepath,/)
- pathtemp =
- FORTEMPI = 0TOUBOUND (ARR_PATH)
- iftempi = 0then
- pathtemp = arr_path (0) &/
- elseiftempi = ubound (arr_path)
- exitfor
- 또 다른
- pathtemp = pathtemp & arr_path (tempi) &/
- endif
- ifcheckdir (pathtemp) = falsethen
- ifmakenewsdir (pathtemp) = falsethen
- savetf = false
- exitfor
- endif
- endif
- 다음
- endif
- '중복 사진을 제거하십시오
- temparray = split (tempstr, $ array $)
- tempstr =
- fortempi = 0toubound (temparray)
- ifinstr (lcase (tempstr), lcase (temparray (temppi))) <1then
- tempstr = tempstr & $ array $ & temparray (temppi)
- endif
- 다음
- tempstr = right (tempstr, len (tempst) -7)
- temparray = split (tempstr, $ array $)
- '상대 사진 주소를 변환하십시오
- tempstr =
- fortempi = 0toubound (temparray)
- tempstr = tempstr & $ array $ & decompitiiteurl (temparray (temppi), tisturl)
- 다음
- tempstr = right (tempstr, len (tempst) -7)
- tempstr = replace (tempstr, chr (0),)
- temparray2 = split (tempstr, $ array $)
- tempstr =
- '이미지 교체/저장
- setre = newRegexp
- re.ignorecase = true
- re.global = true
- fortempi = 0toubound (temparray2)
- implefileurl = temparray2 (tempi)
- ifremotefileurl <> $ false $ andsavetf = truethen'save 이미지
- arrsavefilename = split (remotefileurl,.)
- strfiletype = lcase (arrsavefilename (ubound (arrsavefilename))) '파일 유형
- ifStrFileType = aspostrFileType = asaorstrFileType = aspxorstrFileType = cerorstrFileType = cdxorStrFileType = exeorstrFileType = raroStrFileType = ZipThen
- 업로드 파일 =
- replacesaveremotefile = constr
- 종료 기능
- endif
- 무작위 화
- rannum = int (900*rnd) +100
- strfilename = Year (dtnow) & right (0 & month (dtnow), 2) & 오른쪽 (0 & day (dtnow), 2) & 오른쪽 (0 & hour (dtnow), 2) 및 오른쪽 (0 & minute (dtnow), 2) & 오른쪽 (0 & second (dtnow), 2 ) & 오른쪽 (0 & Second (dtnow), 2) & rannum &. & strfiletype
- re.pattern = temparray (tempi)
- ifsaveremotefile (savepath & strfilename, implefileurl) = truethen
- '*****************************************
- pathtemp = savepath & strfilename
- constr = re.replace (constr, pathtemp)
- re.pattern = strinstalldir & strchanneldir &/
- uploadfiles = uploadfiles & | & re.replace (savepath & strfilename,)
- 또 다른
- pathtemp = remoteFileUrl
- constr = re.replace (constr, pathtemp)
- 'uploadfiles = uploadfiles & | & remotefileurl
- endif
- elseifremotefileurl <> $ false $ andsavetf = falsethen '은 이미지를 저장하지 않습니다
- re.pattern = temparray (tempi)
- ress = re.replace (constr, ormetfileurl)
- uploadfiles = uploadfiles & | & remotefileurl
- endif
- 다음
- setre = 아무것도
- 그런 다음 ifuploadfiles <>
- uploadfiles = right (uploadfiles, len (uploadfiles) -1)
- endif
- replacesaveremotefile = constr
- 최종 기능 장애
함수 매개 변수 설명 :
SPOST : 교체 할 문자열
매개 변수 : Savetf : 파일 저장 여부, False는 저장되지 않음, True Save
매개 변수 : tisturl : 현재 웹 페이지 주소
위의 것은 ASP 교체 및 원격 사진 기능을 저장하는 코드입니다. 모든 사람의 학습에 도움이되기를 바랍니다.