11

我有一个test.cfm页面,想从该页面(test.cfm)调用一个<cffunction>命名为errorEmailusing的 cfc,<cfscript> 而不是

<cfinvoke component = "#cfcPath#" method = "errorEmail" returnVariable = "myReturn" 
    description = "get list of projman">
</cfinvoke> 

我努力了:

<cfscript>
   errorEmail(cfcPath);
</cfscript>
4

1 回答 1

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>
于 2012-07-11T16:22:08.890 回答