ColdFusion Application.cfc - order of execution

前端 未结 5 573
旧巷少年郎
旧巷少年郎 2021-01-05 00:34

I need a reality check - and hopefully an explanation (if my reality is wrong).

The way the CF application framework evaluates things is this (my understanding) - re

5条回答
  •  既然无缘
    2021-01-05 01:05

    The ColdFusion Application.cfc documentation has this tidbit of knowledge:

    When a request executes, ColdFusion runs the CFC methods in the following order:

    1. onApplicationStart (if not run before for this application)
    2. onSessionStart (if not run before for this session)
    3. onRequestStart
    4. onRequest/onCFCRequest
    5. onRequestEnd

    The onApplicationEnd, onSessionEnd, and onError CFCs are triggered by specific events.

    The overall request order has (at least) two more steps.

    0: execute all code in cfcomponent that isn't in a cffunction
    0.5: run the equivalent of the cfapplication tag for creating the Application

    As such the answers to your questions are:

    1. If you're setting those variables in step 0, then yes.
    2. Correct.
    3. That depends on where you're setting the variable. If the values that you are trying to change are listed on the Application variables documentation page for Application.cfc then they must be in step 0. Setting them elsewhere will update the this scope, but will not take effect in step 0.5.

提交回复
热议问题