简体   繁体   English

从函数返回字符串时的神秘空间

[英]Mysterious space at beginning when string returned from a function

Why is there a space at the beginning of the string returned from a function? 为什么在函数返回的字符串的开头有空格?
The solutions seems easy but I am unable to find the reason. 解决方案似乎很容易,但我无法找到原因。

Code

<cffunction name="getString" returntype="string">
    <cfreturn "hello">
</cffunction>
<cfoutput>  
[#getString()#] = getString()
</cfoutput>

Output 产量

[ hello] = getString()

By default CFML functions will produce output, including whitespace. 默认情况下,CFML函数将生成输出,包括空格。 This can cause unwanted white space. 这可能会导致不必要的空白。 Add output="false" to your function. 将output =“false”添加到您的函数中。

<cffunction name="encodeMyPath" returntype="string" output="false">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM