我在coldfusion中有很长的KEY:VALUE
对列表。作为样本
<!--- Info --->
request.INFO = StructNew();
request.INFO.isImportArchiv = false;
request.INFO.lImportArchiv = "";
request.INFO.recordcount = 0;
request.INFO.recordImported = 0;
request.INFO.recordInvalid = 0;
request.INFO.recordNotImported = 0;
request.INFO.recordNotInDB = 0
request.INFO.isImportOK = false;
request.INFO.recordInDBInserted = 0;
<!--- Log messages --->
request.LOG = StructNew();
request.LOG.import = "*************************";
request.LOG.importStart = "*************************";
request.LOG.importFinished = "*************************";
request.LOG.import*** = "*************************";
request.LOG.importAborted = "*************************";
request.LOG.*** = "*************************";
request.LOG.****** = "*************************";
request.LOG.count = "*************************";
request.LOG.onvalidObjects = "*************************";
request.LOG.count*** = "*************************";
request.LOG.count***** = "*************************";
request.LOG.******** = "*************************";
request.LOG.***** = "*************************";
request.LOG.********** = "*************************";
request.LOG.************** = "*************************";
request.LOG.************** = "*************************";
request.LOG.**************** = "*************************";
在ColdFusion中管理此类Info结构有更好的方法吗?
答案 0 :(得分:1)
只要您使用CF8或更高版本,就可以使用结构文字来减少部分输入:
<cfscript>
request.INFO = {
isImportArchiv = false,
lImportArchiv = "",
recordcount = 0,
recordImported = 0,
recordInvalid = 0,
recordNotImported = 0,
recordNotInDB = 0,
isImportOK = false,
recordInDBInserted = 0
};
</cfscript>