java 随机生成头像,ASP实现头像图像随机变换
dim?p,?ppic,?id,?body,?myCache
randomize
p=Int((3*rnd)+1)
id=?Request.QueryString("id")
HttpUrl="http://sms.2e7.net/可愛卡通0"&p&".gif"
Set?myCache?=?new?cache
myCache.name?=?"picindex"&id
If?myCache.valid?Then
body?=?myCache.value
Else
body?=?GetWebData(HttpUrl)
myCache.add?body,dateadd("d",1,now)
End?If
If?Err.Number?=?0?Then
Response.CharSet?=?"UTF-8"
Response.ContentType?=?"application/octet-stream"
Response.BinaryWrite?body
Response.Flush
Else
Wscript.Echo?Err.Description
End?if
'取得數據
Public?Function?GetWebData(ByVal?strid)
Dim?cidpath
cidpath?=?Mid(strid,1,Instr(8,strid,"/"))
Dim?Retrieval
Set?Retrieval?=?Server.CreateObject("Microsoft.XMLHTTP")
With?Retrieval
.Open?"Get",?strid,?False,"",""
.setRequestHeader?"Referer",?cidpath
.Send
GetWebData?=.ResponseBody
End?With
Set?Retrieval?=?Nothing
End?Function
%>
總結
以上是生活随笔為你收集整理的java 随机生成头像,ASP实现头像图像随机变换的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: google是否还能孤独求败,百度 VS
- 下一篇: 易语言 文件捆绑机的原理【转载】