0

首先,感谢您花时间阅读并可能回答这个问题。另外,我是CF的相对菜鸟。

我有一个 .cfm 文件,当用户填写 Web 表单时会调用它(即表单操作使用 POST 方法指向它)。该 .cfm 然后将另一个表单 POST 到数据跟踪端点,并继续下一个面向用户的视图。

我遇到的问题,到目前为止我在整个 Mura 项目中遇到的问题是 Application 范围没有按照我期望的方式工作。例如,我这样设置应用程序变量:

<cfif isDefined(form.campaign) AND len(form.campaign) >
        <cfset application.campaign = form.campaign />
    <cfelse>
        <cfset application.campaign = 'default' />
</cfif>
<cfif isDefined(form.channel) AND len(form.channel)>
        <cfset application.channel = form.channel />
    <cfelse>
        <cfset application.channel = form.channel/>
</cfif>

如果在这种情况下 cfdump 会根据我传递的内容得出预期值。但是,一旦我转发到下一个视图(使用cflocation)和cfdump应用程序范围,这两个键就不可用了。

我的印象是应用程序范围应该在会话中持续存在,或多或少?

4

1 回答 1

1

TLDR: Make sure there is only one instance of Application.cfX anywhere in your application.

A team member had created a file called application.cfm in a higher level of the directory than Application.cfc, which took precedence over the proper file and broke a ton of stuff.

It was added to try to make HTTP requests to .cfm files used for business logic/form processing. This permitted that, but created many other problems.

Removed that file from the directory, moved form processing logic to /remote (which Mura supports for HTTP requests) and refactored some code; application and session scopes are once again available throughout the application, as is Mura($) scope.

于 2017-05-25T16:58:36.900 回答