gpt4 book ai didi

coldfusion - 参数和返回类型中包含对象类型的 cfscript 组件函数

转载 作者:行者123 更新时间:2023-12-03 17:15:21 25 4
gpt4 key购买 nike

我觉得这是 CF9 中的一个错误,从这个来看:How to specify argument attributes in CFscript? (CF9)

但是,如果没有,我将在 CF9(纯)中编写一个 cfscript 组件,并尝试将参数作为一种用户定义的 cfc 进行传递。

public function init(required _lbr._core._sharing._access.accessLinkDAO oAccessLinkDAO) returntype="_lbr._core._sharing._access.accessLinkBusiness" {

但是 CF 不断返回:

You cannot use a variable reference with "." operators in this context

这是 CF9 pure 的问题吗?

最佳答案

我已经确认这是 CF9.0 中的错误(并在 CF9.0.1 或 CF9.0.2 之一中修复;可能是 9.0.1)。

但是修复很容易。问题仅在于虚线路径,正如@ScottStroz 指出的那样,您不需要它们。这很好用:

component {
public accessLinkBusiness function init(required accessLinkDAO oAccessLinkDAO) {
return this;
}
}

我移动了返回类型只是因为那只是它的正常位置:它也可以作为属性使用(但这种语法太糟糕了)。

如果您作为返回类型或参数类型引用的 CFC 与使用它们的 CFC 不在同一目录中,请使用导入语句,例如在这种情况下:

import _lbr._core._sharing._access.*;

关于coldfusion - 参数和返回类型中包含对象类型的 cfscript 组件函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25665624/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com