我有一个test.cfm
页面,并希望使用<cffunction>
使用errorEmail
从该页面(test.cfm)调用名为<cfscript>
的cfc,而不是
<cfinvoke component = "#cfcPath#" method = "errorEmail" returnVariable = "myReturn"
description = "get list of projman">
</cfinvoke>
我试过了:
<cfscript>
errorEmail(cfcPath);
</cfscript>
答案 0 :(得分:13)
我一直这样做。
1)创建对象:
<cfscript>
// CREATE OBJECT
TheCFC = createObject("component", "thecfc");
</cfscript>
2)调用函数:
<cfscript>
// CALL THE FUNCTION
SomeVariable = TheCFC .theFunction();
</cfscript>
您的版本将如下所示
<cfscript>
// CREATE OBJECT
TheObject = createObject("component", "cfcPath");
// CALL THE FUNCTION
myReturn = TheObject.errorEmail();
</cfscript>