Lucee - Coldfusion新关键字不起作用

时间:2016-03-30 16:34:37

标签: coldfusion railo lucee

我正在尝试使用new关键字调用组件,但它无效。

以下方法可以正常使用:

<cfset test = CreateObject("component", "test-objects.shipping_new").init(bar="Blah", foo="boom")>

但是当我尝试使用以下内容时:

<cfset test = New test-objects.shipping_new(bar="Blah", foo="boom") />

我收到错误tag cfset is not closed。上面的代码是我试图从中调用它的文件的第一行,除非我遗漏了标记看起来对我不熟的东西。我正在使用Lucee 4.5,如果这有所不同。

1 个答案:

答案 0 :(得分:9)

问题是hyphen

  

如果文件夹名称或CFC名称具有连字符,请使用以下语法:

     

cfObject=new "cfc-path"(constructorParam1,...)