> Examples <cfloop from="1" to="10" step="2" index="i"> <cfoutput>
names3=#names#+3 /> <cfset names4=#names#+#names# /> 这里 names2 会被认为是 3+3 的字符串 而 names3 和 names4 实际上是 6 <cfloop from="1" to="10" index="i"> <cfloop from="1" to="10" index="j"> <cfoutput> #i+j# </cfoutput > </cfloop> </cfloop> 这段代码会输出总和 但是注意如果将输出行改为 #i#+#j# 那么就会输出很多 X+X 这种格式的东西 声明局部变量 只需要添加一个 var 关键字,
CC_TEST"> select top(10) [CONTACTID] from ltbContact; </cfquery> 使用方法 CF: 一般搜索结果会有很多行, 因此只需要使用循环输出 <cfloop ][index]); arrayAppend(sumArray, val(QuerySuperSet[arguments.ColumnName][index])); } } 按列顺序输出 cfloop query with group 仅在 CF11 之后版本有效 注意最后一层我们是按照 Loc 输出,loc 还是要出现在 loop 的 group 里面 必须使用已经排序好的 Query <cfloop query="sites" group="orgname"> <optgroup label="#sites.orgname#"></optgroup> <cfloop group="suborg #" orgId="#sites.org#">#sites.location#</option> </cfloop> </optgroup> </cfloop> </cfloop
table table-bordered table-condensed table-datasubset">
<cfloop index="i" array="#arData.data.xmlchildren[1].xmlchildren#">
#i.xmlname#
</cfloop >
sbiztemplist = ""> <cfset arrSearch = structfindvalue(structConcerns.IncidentsDetail,subbusiness,"all")> <cfloop sbiztemplist = listAppend(sbiztemplist,arrSearch[arr].owner.Orgname,"|")> </cfif> </cfif> </cfloop Example <cfset list="Partner,Response Date,Response Status" /> <cfloop from="1" to="#listLen(list)#" index="i"> <cfoutput> listGetAt(list, i) </cfoutput> </cfloop> Array 在 cfscript 中以 data=[0,0,0,0,0
Struct cannot be used as an array 格式转换错误 可能是将 struct 放到了 cfloop 的 array 参数中因此报错 ColdFusion - Error:
kCFRunLoopAllActivities, YES, 0, &myRunLoopObserver, &context); if (observer){ CFRunLoopRef cfLoop = [myRunLoop getCFRunLoop]; CFRunLoopAddObserver(cfLoop, observer, kCFRunLoopDefaultMode); kCFRunLoopAllActivities, YES, 0, &myRunLoopObserver, &context); if (observer){ CFRunLoopRef cfLoop = [myRunLoop getCFRunLoop]; CFRunLoopAddObserver(cfLoop, observer, kCFRunLoopDefaultMode); = [myRunLoop getCFRunLoop]; CFRunLoopAddObserver(cfLoop, observer, kCFRunLoopDefaultMode);
kCFRunLoopAllActivities, YES, 0, &myRunLoopObserver, &context); if (observer) { CFRunLoopRef cfLoop = [myRunLoop getCFRunLoop]; CFRunLoopAddObserver(cfLoop, observer, kCFRunLoopDefaultMode);
<cfloop array="#finds#" index="str"> <cfset str = rereplace(listRest(str, '.'), '.$', '') /> [..snip currAction] = 1 /> <cfelse> <cfset searchresults[str][currAction]++ /> </cfif> </cfif> </cfloop
kCFRunLoopAllActivities, YES, 0, &myRunLoopObserver, &context); if (observer) { CFRunLoopRef cfLoop = [myRunLoop getCFRunLoop]; CFRunLoopAddObserver(cfLoop, observer, kCFRunLoopDefaultMode);
kCFRunLoopBeforeTimers, YES, 0, &myRunLoopObserver, &context); if (observer) { CFRunLoopRef cfLoop = [myRunLoop getCFRunLoop]; CFRunLoopAddObserver(cfLoop, observer, kCFRunLoopDefaultMode);