代码之家  ›  专栏  ›  技术社区  ›  Larsenal

如何清除ColdFusion中的响应缓冲区?

  •  5
  • Larsenal  · 技术社区  · 14 年前

    Response.Clear()

    2 回复  |  直到 14 年前
        1
  •  12
  •   jfrobishow    14 年前

    这将清除响应主体并阻止缓冲内容的输出-

    <cfset GetPageContext().getCFOutput().clear()>
    
        2
  •  29
  •   Ryan Cogswell    5 年前

    可以使用 cfcontent 用reset参数标记:

    <cfcontent reset="true">
    
        3
  •  0
  •   Ryan Cogswell    5 年前

    现有的两个答案( <cfset GetPageContext().getCFOutput().clear()> <cfcontent reset="true"> )将重置主内容缓冲区,但这些命令不会重置标头缓冲区(即ColdFusion自动插入到 <head> 元素,例如 <script> <cfchart> ).

    要重置所有内容,可以使用以下方法之一:

    <cfcontent reset="true" resethead="true">
    

    <cfset getPageContext().getCFOutput().clearAll()>
    <cfset getPageContext().getCFOutput().clearHeaderBuffers()>
    

    相关答案: Is there a way to prevent cfchart from forcing js into response content?