使用 CFSCRIPT 循环访问集合

<cfscript>
  /*define collection*/
  attributes = {
    "name": "Sales",
    "type": "text",
    "value": "Connection"
  };
  for(attribute in attributes){
    /* attribute variable will contain the key name of each key value pair in loop */
    WriteOutput('Key : ' & attribute & ', Value : ' & attributes[attribute] & '<br/>');
  }
</cfscript>