简体   繁体   中英

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. This can cause unwanted white space. Add output="false" to your function.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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