停止 ColdFusion 输出空白的正确方法是什么?
我知道有cfcontent
and cfsetting enableCFoutputOnly
。这样做的正确方法是什么?
此外<cfsilent>
, <cfsetting enablecfoutputonly="yes">
and <cfprocessingdirective suppressWhiteSpace = "true">
is <cfcontent reset="true" />
。您可以使用它删除文档开头的空格。
HTML5 文档将像这样开始:
<cfcontent type="text/html; charset=utf-8" reset="true" /><!doctype html>
XML 文档:
<cfcontent reset="yes" type="text/xml; charset=utf-8" /><CFOUTPUT>#VariableHoldingXmlDocAsString#</CFOUTPUT>
这样,您就不会收到 XML 文档的“序言中不允许内容”错误。
如果您从函数中得到不需要的空格,请使用output
- 抑制任何输出并将结果作为字符串返回的属性 - 例如:
<cffunction name="getMyName" access="public" returntype="string" output="no">
<cfreturn "Seybsen" />
</cffunction>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)