时间:2021-07-01 10:21:17 帮助过:20人阅读
- <br><!--?php <BR-->$p=$_GET['p']; <br>$pics=file($p); <br>for($i=0;$i< count($pics);$i++) <br>{ <br>echo $pics[$i]; <br>} <br>?> <br> <br><br>使用方法:将文件保存成i.php上传到根目录 <br>将不能外链的图片地址改成http://你的域名p.php?p=图片地址 <br><br>asp版,网上用的比较多的<br><span><u></u></span> 代码如下:<br><% <br>Dim url, body, myCache <br>url = Request.QueryString("url") <br>Set myCache = new cache <br>myCache.name = "picindex"&url <br>If myCache.valid Then <br>body = myCache.value <br>Else <br>body = GetWebData(url) <br>myCache.add body,dateadd("d",1,now) <br>End If <br>If Err.Number = 0 Then <br>Response.CharSet = "UTF-8" <br>Response.ContentType = "application/octet-stream" <br>Response.BinaryWrite body <br>Response.Flush <br>Else <br>Wscript.Echo Err.Description <br>End if <br>'取得数据 <br>Public Function GetWebData(ByVal strUrl) <br>Dim curlpath <br>curlpath = Mid(strUrl,1,Instr(8,strUrl,"/")) <br>Dim Retrieval <br>Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP") <br>With Retrieval <br>.Open "Get", strUrl, False,"","" <br>.setRequestHeader "Referer", curlpath <br>.Send <br>GetWebData =.ResponseBody <br>End With <br>Set Retrieval = Nothing <br>End Function <br>'cache类 <br>class Cache <br>private obj 'cache内容 <br>private expireTime '过期时间 <br>private expireTimeName '过期时间application名 <br>private cacheName 'cache内容application名 <br>private path 'url <br>private sub class_initialize() <br>path=request.servervariables("url") <br>path=left(path,instrRev(path,"/")) <br>end sub <br>private sub class_terminate() <br>end sub <br>public property get blEmpty <br>'是否为空 <br>if isempty(obj) then <br>blEmpty=true <br>else <br>blEmpty=false <br>end if <br>end property <br>public property get valid <br>'是否可用(过期) <br>if isempty(obj) or not isDate(expireTime) then <br>valid=false <br>elseif CDate(expireTime)<now then="" <br="">valid=false <br>else <br>valid=true <br>end if <br>end property <br>public property let name(str) <br>'设置cache名 <br>cacheName=str & path <br>obj=application(cacheName) <br>expireTimeName=str & "expires" & path <br>expireTime=application(expireTimeName) <br>end property <br>public property let expires(tm) <br>'重设置过期时间 <br>expireTime=tm <br>application.lock <br>application(expireTimeName)=expireTime <br>application.unlock <br>end property <br>public sub add(var,expire) <br>'赋值 <br>if isempty(var) or not isDate(expire) then <br>exit sub <br>end if <br>obj=var <br>expireTime=expire <br>application.lock <br>application(cacheName)=obj <br>application(expireTimeName)=expireTime <br>application.unlock <br>end sub <br>public property get value <br>'取值 <br>if isempty(obj) or not isDate(expireTime) then <br>value=null <br>elseif CDate(expireTime)<now then="" <br="">value=null <br>else <br>value=obj <br>end if <br>end property <br>public sub makeEmpty() <br>'释放application <br>application.lock <br>application(cacheName)=empty <br>application(expireTimeName)=empty <br>application.unlock <br>obj=empty <br>expireTime=empty <br>end sub <br>public function equal(var2) <br>'比较 <br>if typename(obj)<>typename(var2) then <br>equal=false <br>elseif typename(obj)="Object" then <br>if obj is var2 then <br>equal=true <br>else <br>equal=false <br>end if <br>elseif typename(obj)="Variant()" then <br>if join(obj,"^")=join(var2,"^") then <br>equal=true <br>else <br>equal=false <br>end if <br>else <br>if obj=var2 then <br>equal=true <br>else <br>equal=false <br>end if <br>end if <br>end function <br>end class <br>%><br><br>使用方法:将文件保存成i.asp上传到根目录 <br>将不能外链的图片地址改成http://你的域名/p.asp?url=图片地址 <br>为方便大家使用,复制的代码,容易出现错误。特打包下载 </now></now>