-1

我有一个很长的KEY:VALUEcoldfusion配对列表。作为样本

<!--- 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 中的此类信息结构?

4

1 回答 1

1

只要您使用的是 CF8 或更高版本,您就可以使用结构文字来减少一些输入:

<cfscript>
request.INFO = {
    isImportArchiv = false,
    lImportArchiv = "",
    recordcount = 0,
    recordImported = 0,
    recordInvalid = 0,
    recordNotImported = 0,
    recordNotInDB = 0,
    isImportOK = false,
    recordInDBInserted = 0
};
</cfscript>
于 2013-04-11T16:22:22.777 回答