在ColdFusion版本9中,我在Index.cfm中包含以下内容:
<cfdump var="#Application#">但我得到的唯一结果是一个带有应用程序名称的结构--没有其他变量,比如rootPath、mappings或customTagPath。
以下是我在Application.cfc中拥有的内容:
<cfcomponent output="false">
<cfset this.name = left("App_#hash(getCurrentTemplatePath())#",64)>
<cfset this.applicationTimeout = createTimeSpan(0,8,0,0)>
<cfset this.sessionManagement=True>
<cfset this.loginStorage = "session">
<cfset this.clientManagement = False>
<cfset this.setClientCookies = True>
<cfset this.setDomainCookies = False>
<cfset this.scriptProtect = "all">
<cfset this.rootPath = getDirectoryFromPath(getCurrentTemplatePath())>
<cfset this.mappings = this.rootPath>
<cfset this.customTagPaths = "#this.rootPath#Components">发布于 2010-03-11 22:11:35
这是因为这些设置不在Application作用域中。您混淆了应用程序设置和应用程序值。如果希望它们在Application作用域中可用,只需在onApplicationStart()中设置它们即可。当然,您也可以通过This作用域查看它们,因此您可以将值复制到那里。
https://stackoverflow.com/questions/2425460
复制相似问题