函数参数中的 Coldfusion 结构
我正在尝试进行服务器端 facebook 连接,但是 sdk (在这里获取< /a>) 提供了以下错误:
Invalid CFML construct found on line 523 at column 78.
ColdFusion was looking at the following text:
{
并且它没有解释为什么会抛出此错误。我不擅长 cfscript,所以我不知道 sdk 是否使用正确的语法,但它在函数参数中的结构大括号处抛出了这个函数的错误:
private String function getUrl(String path = "", Struct parameters = {})
{
var key = "";
var resultUrl = "https://www.facebook.com/" & arguments.path;
if (structCount(arguments.parameters)) {
resultUrl = resultUrl & "?" & serializeQueryString(arguments.parameters);
}
return resultUrl;
}
我原以为使用 sdk 会毫无疑问,但显然我错过了一些东西。 我做错了什么?
第 2 部分: 代码现在停止在:
for (var propertyName in arguments.properties) {
httpService.addParam(type="formField", name=propertyName, value=arguments.properties[propertyName]);
}
Are you not allowed to use a for loop in cfscript?
I'm trying to do server side facebook connect, but the sdk (get it here) provided gives the following error:
Invalid CFML construct found on line 523 at column 78.
ColdFusion was looking at the following text:
{
And it doesn't explain why it's throwing this error. I'm not good at cfscript, so I don't know whether the sdk uses the correct syntax, but it throws the error on this function, at the braces of the struct in the function arguments:
private String function getUrl(String path = "", Struct parameters = {})
{
var key = "";
var resultUrl = "https://www.facebook.com/" & arguments.path;
if (structCount(arguments.parameters)) {
resultUrl = resultUrl & "?" & serializeQueryString(arguments.parameters);
}
return resultUrl;
}
I had thought that using an sdk would be a no brainer, but apparently I'm missing something.
What am I doing wrong?
Part 2:
The code now comes to a halt at:
for (var propertyName in arguments.properties) {
httpService.addParam(type="formField", name=propertyName, value=arguments.properties[propertyName]);
}
Are you not allowed to use a for loop in cfscript?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试 structNew() 或“#structNew()#”而不是 {}
Try structNew() or "#structNew()#" instead of {}
这应该适用于连接到 Facebook 并获取访问令牌:
This should work for connecting to Facebook and getting an access token: