asp 读取 json 列表解决思路__1.docx

上传人:PIYPING 文档编号:11633127 上传时间:2021-08-27 格式:DOCX 页数:4 大小:12.22KB
返回 下载 相关 举报
asp 读取 json 列表解决思路__1.docx_第1页
第1页 / 共4页
asp 读取 json 列表解决思路__1.docx_第2页
第2页 / 共4页
asp 读取 json 列表解决思路__1.docx_第3页
第3页 / 共4页
asp 读取 json 列表解决思路__1.docx_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

《asp 读取 json 列表解决思路__1.docx》由会员分享,可在线阅读,更多相关《asp 读取 json 列表解决思路__1.docx(4页珍藏版)》请在三一文库上搜索。

1、asp 读取 json 列表解决思路_ 怎么用asp程序读取URL再用程序读取出结果,求完整ASP程序 -解决方案- 原来不是发过了?学问变成数组了而且,方法都差不多http:/ script runat=server language=jscript function getJSON(v) return eval( + v + ); function toArray(a) /JSON对象数组格式的字符串 var dic = Server.CreateObject(Scripting.Dictionary); for (var i = 0; i a.length; i+) var obj =

2、Server.CreateObject(Scripting.Dictionary); for (x in ai) obj.Add(x, aix); dic.Add(i, obj); return dic; /script % = 从2进制数据流生成内容 = Function BytesToBstr(strBody,CodeBase) dim obj set obj=Server.CreateObject(Adodb.Stream) obj.Type=1 obj.Mode=3 obj.Open obj.Write strBody obj.Position=0 obj.Type=2 obj.Cha

3、rset=CodeBase BytesToBstr=obj.ReadText obj.Close set obj=nothing End Function function downpage(url) set xhr=server.CreateObject(microsoft.xmlhttp) xhr.open get,url,false xhr.send downpage=BytesToBstr(xhr.responsebody,gb2312)留意你那个页面的编码,要不行能出乱码 end function s改为用Microsoft.XMLHTTP动态猎取 s=downpage(http:/

4、 s=resultcode:200,reason:Return Successd,result:id:1,province:陕西省,city:西安市,area:灞桥区,address:狄寨镇南寨村,id:2,province:陕西省,city:西安市,area:灞桥区,address:狄寨镇潘村 ,id:3,province:陕西省,city:西安市,area:灞桥区,address:狄寨镇伍坊村,error_code:0 set o=getJSON(s) if o.resultcode=200 then set result=toArray(o.result) for i=0 to result.count-1 response.Write result(i)(province)-result(i)(address)br/ next set result=nothing end if set o=nothing % 更多信息请查看IT技术专栏 .

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 科普知识


经营许可证编号:宁ICP备18001539号-1