我被冷融合问题阻止了,任何建议都值得赞赏。现在让我描述一下我的问题。
我的网站根目录中有一个Application.cfc
,其中的内容如下:
<cfcomponent output="false">
<cffunction name="onRequest" returnType="void">
<cfargument name="thePage" type="string" required="true">
<cfinclude template="#arguments.thePage#">
</cffunction>
</cfcomponent>
而且我还有一个名为 cfm 的模板test.cfm
,它的内容如下:
<cfdump var="#variables.this#"><br /><br /><br /><br /><br /><br />
<cfdump var="#this#">
现在,如果您请求test.cfm
,一切正常,但是当我删除该onRequest
方法Application.cfc
并再次请求test.cfm
时,它抱怨说"Element THIS is undefined in VARIABLES. "
,我不知道为什么,有人可以解释一下吗?十分感谢。
ps:
您可以在 中添加任意数量的函数Application.cfc
,例如onSessionStart
, onSessionEnd
, onApplicationStart
, onApplicationEnd
...,但如果没有onRequest
方法,您会请求test.cfm
并得到错误。我只是不知道为什么。