ColdBox变量
handlers/home.cfc
<cffunction name="index" output="false" hint="index">
<cfargument name="event">
<cfset rc.Test = 'This is a test 123.' />
<cfset event.setView("home/index")>
</cffunction>views/home/index.cfm
<cfdump var="#rc#" />为什么rc.test没有出现在垃圾堆里?
发布于 2013-12-11 06:39:03
在没有使用cfargument定义rc的情况下,您的rc.test将在处理程序中设置为variables.rc.test。
执行以下操作:
<cffunction name="index" output="false" hint="index">
<cfargument name="event">
<cfargument name="rc">
<cfargument name="prc">
<cfset rc.Test = 'This is a test 123.' />
<cfset event.setView("home/index")>
</cffunction>发布于 2013-12-28 18:31:26
您需要将RC赋值给Event.getCollection()。我们在每个处理函数的顶部执行此操作。
<cffunction name="index" returntype="void" output="false">
<cfargument name="event" required="true">
<cfscript>
var rc = event.getCollection();
var prc = event.getCollection( private = true );
// your handler code here
Event.setView('home/index');
</cfscript>
</cffunction>https://stackoverflow.com/questions/20505583
复制相似问题