amfPHP 函数输入问题
我正在编写一个 amfPHP 函数,它应该接受字符串输入。它接受字母数字字符没有问题,但不幸的是,如果我发送“2.UgnFl4kAWovazp_tVo6fHg__.86400.1260025200-571701419”作为参数,它返回的数据为“2”。
这是函数(如您所见,非常简单)
function checkOpenSession($guid, $session_key) {
return $session_key;
}
I'm writing an amfPHP function which should take string input. It takes alphanumeric characters without a problem, but unfortunately it returns data as "2" if I send "2.UgnFl4kAWovazp_tVo6fHg__.86400.1260025200-571701419" as parameter.
here is the function (real simple as you can see)
function checkOpenSession($guid, $session_key) {
return $session_key;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
要绕过此服务浏览器错误,如果您希望参数上有一个字符串并且该字符串以数字开头,请在服务浏览器上双引号您的条目。我在通过服务浏览器测试某些方法时遇到了同样的问题,并且工作正常。
To bypass this service browser bug, double quote your entry on the service browser if you expect a string on an argument and this string starts with a number. I was having the same problem testing some methods via service browser and it worked fine.
我只是通过简单的设置尝试了这一点,然后将结果从服务浏览器写入文件,这对我来说似乎没问题。所以问题似乎出在调用端。
另一种可能性是 amfphp 由于前导整数而将返回值的数据类型从字符串更改为 int。尝试在返回字符串的开头放置一些字母数字字符,看看会发生什么。
I just tried this with a simple setup, and just writing the results to a file from the service browser and it seems to be ok for me. So the problem would seem to be in the calling end.
Another possibility is that amfphp changes the datatype of the returned value from a string to an int because of the leading integer. Try putting a some alphanumeric character at the start of the return string and see what that does.
此行为实际上存在于 AMFPHP 服务浏览器中(bug),因此很容易将其误认为是 AMFPHP 正在将数字开头的字符串转换为 int。然而问题出在发送代码上。例如,通过 json 网关发送 urlencoded 字符串可以正常工作(Objective C 代码):
其中 passMD5 可能有一个前导数字。但是,如果我在服务浏览器中为 checkAuth 方法输入适当的值,它就会被破坏。
[编辑]
This behavior is actually present in the AMFPHP service browser(bug), so it is easy to mistake it as the AMFPHP that is converting number-leading strings to int. However the problem is in the sending code. For instance sending a urlencoded string through the json gateway works properly (Objective C code):
Where passMD5 may have a leading number. But if I enter appropriate values for the checkAuth method in the service browser, it is broken.
[edit]
双引号你的字符串...这样就可以解决问题。
double quote your strings... that will work it out.