如何在不使用 cfinvoke 的情况下调用 CFC 上的静态方法?我知道我可以做到这一点:
<cfinvoke component="MyComponent" method="myStaticMethod' arg1="blah" returnvariable=myReturnVar>
我希望能够像调用 UDF 一样调用此方法:
<cfset myReturnVar = MyComponent.myStaticMethod(blah)>
但是,这不起作用。是否有我弄乱的语法,或者这根本不可能?
最佳答案
不可能,因为 ColdFusion 中没有“静态方法”。
<cfinvoke>
您问题中的行与以下内容相同:
myReturnVar = CreateObject("component", "MyComponent").myStaticMethod(arg1="blah");
关于coldfusion - 如何在不使用 cfinvoke 的情况下在 CFC 上运行静态方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2073897/