问题描述
Coldfusion Application / application.cfc而不重置ColdFusion Server实例?如果我记得对,有一些技巧,如在application.cfc中创建一个reinit函数或重命名文件。
How do I reset a Coldfusion Application / application.cfc without resetting the Coldfusion Server instance? If I remember right, there are a few tricks out there such as creating a reinit function within application.cfc or renaming the file.
推荐答案
p>两个步骤:
首先,确保所有应用程序初始化逻辑都包含在CFC的OnApplicationStart方法中。如果它有嵌套调用,这很好 - 只要你可以轻松地通过一个调用重新初始化你的应用程序,使你的生活更容易。
First, make sure all your application initialization logic is contained inside the OnApplicationStart method of your CFC. If it has nested calls, that is fine - just so long as you can re-initialize your application easily through a single call makes your life much easier.
其次,这是我在application.cfc的OnRequestStart方法中使用的代码
Second, this is the code I use in the OnRequestStart method of application.cfc
<cfif structKeyExists(url,'resetappvars')>
<cfset OnApplicationStart() />
</cfif>
您可以随意使用任何编码值代替 resetAppVars 。
Feel free to use whatever coded value you would like in place of resetAppVars.
这篇关于如何重置application.cfc而不重置服务器实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!