|
本文讨论区:http://bbs.foosun.net/dispbbs.asp?boardID=22&ID=14153&page=1
根目录/INC/FUNCTION。ASP中,红的为后加,查找这个!“Function ReplaceRemoteUrl(”
'----------获得随机名 function Rndname(filename) randomize dim i For i=1 to 8 Rndname=Rndname & INT(Rnd*9) next Rndname=Rndname&filename end function '---------- Function ReplaceRemoteUrl(NewsContent,SaveFilePath,FunDoMain,DummyPath) Dim re,RemoteFile,RemoteFileurl,SaveFileName,FileName,FileExtName,SaveImagePath Set re = New RegExp re.IgnoreCase = True re.Global=True re.Pattern = "((http|https|ftp|rtsp|mms):(\/\/|\\\\){1}((\w)+[.]){1,}(net|com|cn|org|cc|tv|[0-9]{1,3})(\S*\/)((\S)+[.]{1}(gif|jpg|png|bmp)))" Set RemoteFile = re.Execute(NewsContent) Set re = Nothing For Each RemoteFileurl in RemoteFile SaveFileName = Mid(RemoteFileurl,InstrRev(RemoteFileurl,"/")+1) FileExtName = Mid(SaveFileName,InstrRev(SaveFileName,".")+1) SaveFileName =Rndname(SaveFileName) Call SaveRemoteFile(DummyPath & SaveFilePath & "/" & SaveFileName,RemoteFileurl) NewsContent = Replace(NewsContent,RemoteFileurl,FunDoMain & SaveFilePath & "/" & SaveFileName) Next ReplaceRemoteUrl = NewsContent End Function
|