如何在不使用cfinvoke的情况下在CFC上运行静态方法?

der*_*ion 2 coldfusion cfc

如何在不使用cfinvoke的情况下在CFC上调用静态方法?我知道我可以这样做:

<cfinvoke component="MyComponent" method="myStaticMethod' arg1="blah" returnvariable=myReturnVar>
Run Code Online (Sandbox Code Playgroud)

我希望能够以与UDF相同的方式调用此方法:

<cfset myReturnVar = MyComponent.myStaticMethod(blah)>
Run Code Online (Sandbox Code Playgroud)

但是,这不起作用.有语法,我搞砸了或者这是不可能的?

Hen*_*nry 5

不可能,因为ColdFusion中没有"静态方法".

<cfinvoke>你的问题行是一样的:

myReturnVar = CreateObject("component", "MyComponent").myStaticMethod(arg1="blah");
Run Code Online (Sandbox Code Playgroud)