ASP实现头像图像随机变换

2018-09-06 11:59

阅读:278

  复制代码 代码如下:
<%OnErrorResumeNext%>
<%
dimp,ppic,id,body,myCache
randomize
p=Int((3*rnd)+1)
id=Request.QueryString(id)
HttpUrl=可爱卡通0&p&.gif
SetmyCache=newcache
IfmyCache.validThen
body=myCache.value
Else
body=GetWebData(HttpUrl)
myCache.addbody,dateadd(d,1,now)
EndIf

IfErr.Number=0Then
Response.CharSet=UTF-8
Response.BinaryWritebody
Response.Flush
Else
Wscript.EchoErr.Description
Endif

取得数据
PublicFunctionGetWebData(ByValstrid)
Dimcidpath
cidpath=Mid(strid,1,Instr(8,strid,/))
DimRetrieval
SetRetrieval=Server.CreateObject(Microsoft.XMLHTTP)
WithRetrieval
.OpenGet,strid,False,,
.setRequestHeaderReferer,cidpath
.Send
GetWebData=.ResponseBody
EndWith
SetRetrieval=Nothing
EndFunction
%>



评论


亲,登录后才可以留言!