カスタム デバッグ ツールを作成しようとしていますが、2 つの個別の関数を含むコンポーネントを使用する必要があります。最初の関数 ( startTimer) には などの引数がstartCountあり、もう 1 つの関数 ( endTimer)には がありendCountます。私が達成しようとしているのは、次のコードのようなものです。
<cffunction name="startTimer" access="public" returntype="void">
<cfargument name="startActionTime" type="string" required="no">
</cffunction>
<cffunction name="endTimer" returntype="void" access="public">
<cfargument name="endActionTime" type="string" required="no">
<cfset finalTime = endActionTime - startTimer.startActionTime>
<!---Some SQL will go here to record the data in a db table --->
</cffunction>
そして、これが私が関数を呼び出す方法です
<cfscript>
location = CreateObject("component","timer");
loc =location.startTimer(
startActionTime = getTickCount()
);
end = location.endTimer(
endActionTime = getTickCount()
);
</cfscript>
コードを実行しようとすると で未定義のエラーが発生するため、スコープの問題が発生していると思いますstartTimer.startActionTime。このようなことを行う正しい方法は何ですか?