开发者

What does CFEXIT do inside a function in a CFC?

开发者 https://www.devze.com 2023-03-23 21:10 出处:网络
What does <c开发者_高级运维fexit> do inside a function, inside a cfc? Is it the same as <cfabort>?

What does <c开发者_高级运维fexit> do inside a function, inside a cfc?

Is it the same as <cfabort>?

I'm refactoring some legacy code, and wonder if I need to pay special attention to it...

Thanks.


My recollection of how a basic <cfexit> behaves is:

  1. Used within a CFC, cfexit exits the cfc function. But processing of the calling page continues.
  2. If within a function, but NOT inside a cfc, then processing is aborted.

Update: I just confirmed that behavior under CF9.0.1

Results (using cfexit)

Start calling page 
Called test()
Finish calling page 
Called on requestEnd

Results (using cfabort)

Start calling page 
Called test()
Called on requestEnd

Test.cfm

Start calling page <br />
<cfset createObject("component", "Foo").test()>
Finish calling page <br />

Foo.cfc

<cfcomponent>
    <cffunction name="test" output="true">
        Called test()<br />
        <cfexit>
    </cffunction>
</cfcomponent>
0

精彩评论

暂无评论...
验证码 换一张
取 消