在我用来在屏幕上输出它之后,我有一个看起来像这样的二维数组:
array
1
array
1 0600
2
array
1 0
3
array
1 0600
4
array
1 0
5
array
1 0615
6
array
1 0
7
array
1 0615
8
array
1 0
9
array
1 0630
10
array
1 0
11
array
1 0630
12
array
1 1
所以我想按以下顺序循环遍历我的数组和输出值:
0600 0
0600 0
0615 0
0615 0
0630 0
0630 1
这是我创建数组的代码:
<cfloop list="#ListGetAt(dataList,i,",")#" index="z" delimiters="|">
<cfoutput query="getR" group="theYear">
<cfset name = myArray.append([z])>
<cfif Description eq z>
<cfset count = myArray.append([theCount])>
<cfelse>
<cfset count = myArray.append([0])>
</cfif>
</cfoutput>
</cfloop>
那么我现在如何循环以按照我上面向您展示的顺序获取这两条记录?我试过这个,但没有奏效:
<cfoutput>
<cfloop from="1" to="#arraylen(myArray)#" index="i">
<cfloop array="#myArray#" index="j">
#i# - #myArray[1][j]#<br/>
</cfloop>
</cfloop>
</cfoutput>
编辑: 当我使用此代码时:
<cfloop array="#myArray#" index="i">
<cfloop array="#myArray#" index="j">
<cfoutput> #myArray[i][j]#<br/> </cfoutput>
</cfloop>
</cfloop>
我收到了这个错误:
The value coldfusion.runtime.Array cannot be converted to a number.
如果有人可以帮助解决这个问题,请告诉我。