首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Application.cfc内置变量

Application.cfc内置变量
EN

Stack Overflow用户
提问于 2010-03-11 22:00:45
回答 1查看 510关注 0票数 3

在ColdFusion版本9中,我在Index.cfm中包含以下内容:

代码语言:javascript
复制
<cfdump var="#Application#">

但我得到的唯一结果是一个带有应用程序名称的结构--没有其他变量,比如rootPath、mappings或customTagPath。

以下是我在Application.cfc中拥有的内容:

代码语言:javascript
复制
<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">
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-03-11 22:11:35

这是因为这些设置不在Application作用域中。您混淆了应用程序设置和应用程序值。如果希望它们在Application作用域中可用,只需在onApplicationStart()中设置它们即可。当然,您也可以通过This作用域查看它们,因此您可以将值复制到那里。

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2425460

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档