Facebook PHP 表单返回空 $_POST
我最近一直在开发一些 Facebook 应用程序,但总是遇到同样的问题:我找不到在 iFrame Facebook 应用程序上使用 POST 方法发送表单的方法。返回的 $_POST
始终为空。
我发现的一个补丁是使用 GET 方法使用表单发送数据,并将其发送到画布页面脚本 URL,就像这样:
现在,我遇到的问题是我需要上传一个文件,然后我必须使用POST方法,然后回到最初的问题->我找不到使用 POST 方法发送表单的方法。返回的 $_POST
始终为空!
有人有答案吗?
I've been developing some Facebook apps lately and I always had the same problem: I can't find a way to send a form with a POST method on iFrame Facebook apps. The returned $_POST
is always empty.
One patch I found is to send my data using a form using a GET method and to send it to the canvas page script URL, just like this: <form action="<?php echo CANVAS_PAGE; ?>script.php" method="GET" >
and then to get my data through $_REQUEST
.
I tried any combination of POST /GET method with CANVAS_PAGE/script.php
/ CANVAS_URL/script.php
/ script.php
action and this is only thing that actually works. AT least for me.
Now, the problem I have is that I need to upload a file and then I must use the POST method and then back to the initial problem -> I can't find a way to send a form with a POST method. The returned $_POST
is always empty!!
Anybody has an answer to that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找到答案了。
只要您将 $_REQUEST["signed_request"] 作为表单中名为“signed_request”的隐藏字段传递,Facebook 中的 post 方法就可以正常工作。
Answer found.
The post method in Facebook works fine as long as you pass the $_REQUEST["signed_request"] as a hidden field called "signed_request" in your form.