在 CF9 文档中:在 CFScript 中定义组件和函数 http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSE99A664D-44E3-44d1-92A0-5FDF8D82B55C.html#WSf01dbd23413dda0e-66bfe46b1200fb22099-7ffc, 它说:
/**
*Comment text, treated as a hint.
*Set metadata, including, optionally, attributes, in the last entries
*in the comment block, as follows:
*@metadataName metadataValue
...
*/
access returnType function functionName(arg1Type arg1Name="defaultValue1"
arg1Attribute="attributeValue...,arg2Type
arg2Name="defaultValue2" arg2Attribute="attributeValue...,...)
functionAttributeName="attributeValue" ... {
body contents
}
你如何指定arg1Attribute
?我试过这个:
public void function setFirstname(string firstname="" displayName="first name"){}
但它不起作用。
另外,你如何将其转换为脚本风格?
<cffunction name="setPerson">
<cfargument name="person" type="com.Person"/>
</cffunction>
I tried:
function setPerson(com.Person person){}
它也不起作用。它说:“在这种情况下,您不能将变量引用与“.”运算符一起使用”。