将结构传递给函数会产生嵌套结构
当我将结构传递给需要结构的函数时,该函数会嵌套在另一个结构中。
例如:
function getAnswerFromSO(struct question=StructNew()) {
writeDump(arguments.question);
}
调用getAnswerFromSO(question=myStruct);
会导致
question {
myStruct = {
text = 'foo',
subj = 'bar',
user = 1 }
};
** 显然,这不是cfdump
输出的样子,但它同样说明了问题。
有没有办法防止这种嵌套?
When I pass a struct to a function that is expecting a struct, the function is nested inside another struct.
For example:
function getAnswerFromSO(struct question=StructNew()) {
writeDump(arguments.question);
}
CallinggetAnswerFromSO(question=myStruct);
results in
question {
myStruct = {
text = 'foo',
subj = 'bar',
user = 1 }
};
** Obviously, this is not what a cfdump
output looks like, but it illustrates the issue just the same.
Is there a way to prevent this nesting?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可以确认 Ray 的示例也适用于 CF9。
I can confirm that Ray's example works on CF9 as well.