ASP返回数组问题

来源:百度知道 编辑:UC知道 时间:2024/05/12 10:17:10
有两个页面
---GetSplit.asp----
<%
public Function GetSplitArray(data)

sp=split(data,"&" )
dim a(6)
for i=0 to Ubound(sp)

s1=split(sp(i),"=")

a(i)=s1(1)
'response.Write a(i)&"<br>"
Next

End Function

%>

------------Get.asp--------
<!--#include file="GetSplit.asp"-->

<%
Data="ID=00006&Curr=CNY&Amount=0.01&Ref=20080307053020&Cust=To00001&TransTime=2008-03-07 2005:30:20&ReturnUrl=http://MerchantReceive.aspx"
'GetSplitArray(data)
%>

在Get.asp怎么得到GetSplit.asp数组返回的值

你那种方法肯定会出错,因为以&分割只得到6维数组,用=分割得到7维数组

不知道你要返回什么样的值,以下代码返回四种值,其中有一种肯定是你要的,因为只有这四种返回值

<%
public Function GetSplitArray(data)
response.Write"第一种返回值<br>"
sp=split(data,"&")
for i=0 to Ubound(sp)
d=d+sp(i)
response.Write sp(i)&"<br>"
Next

response.Write"<br>第二种返回值<br>"
s=split(d,"=")
for i=0 to Ubound(s)
response.Write s(i)&"<br>"
Next

response.Write"<br>第三种返回值<br>"
sp1=split(data,"&")
for i=0 to Ubound(sp1)
c=Right(sp1(i),Len(sp1(i))-InstrRev(sp1(i),"="))
response.Write c&"<br>"
Next

response.Write"<br>第四种返回值<br>"
sp2=split(data,"&")
for i=0 to Ubound(sp2)
e=left(sp2(i),Instr(sp2(i),"=")-1)
response.Write e&"<br>"