2016-03-30 99 views
6

我想用new關鍵字調用組件,但它不起作用。Lucee - Coldfusion新關鍵字不工作

下下面的方法正常工作:

<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。

回答

9

的問題是hyphen

如果文件夾名稱或CFC名有連字符,請使用以下語法:

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

+1

什麼是痛苦的,但僅此而已!感謝您的幫助 – Yamaha32088