简体   繁体   English

操作方法:使用图表 API 将照片上传到用户的个人资料

[英]How-To: Use the Graph API to Upload Photos to a user’s profile

I am developing an application which uploads images into user's profile.I manage to do this by referring this blog我正在开发一个将图像上传到用户个人资料中的应用程序。我通过引用这个博客来做到这一点

https://developers.facebook.com/blog/post/498/ https://developers.facebook.com/blog/post/498/

Everything works fine and display the 'id' of the uploaded image.一切正常并显示上传图像的“id”。

Now I want to take this id into a variable and pass it to another file without displaying 'id' of the image(Lets say I want to pass this id into a.php file and display the 'id' using 'echo' command).现在我想将此 id 放入一个变量并将其传递给另一个文件而不显示图像的“id”(假设我想将此 id 传递到一个 .php 文件中并使用“echo”命令显示“id”) .

Can any one help me to do this?任何人都可以帮我做到这一点吗? I think this is not a difficult task.Since I have vary poor knowledge about php, I cannot figure out any way.我认为这不是一项艰巨的任务。由于我对 php 的了解并不多,所以我想不出任何办法。

Can any one please please help me to solve this problem.任何人都可以请帮我解决这个问题。

Thanks.谢谢。

What do you mean by "pass into another php file?" “传入另一个 php 文件”是什么意思? If you mean reload the page but with passing the ID you can use $_GET array.如果您的意思是重新加载页面但传递 ID,您可以使用 $_GET 数组。

Simply, after receiving the id from uploaded photo you can call function:简单地说,在收到上传照片的 id 后,您可以调用 function:

header('location : http://yourdomain.com/a.php?id='.$id_of_photo);

and then in a.php you can get it by accessing $_GET array然后在 a.php 中,您可以通过访问 $_GET 数组来获取它

if(isset($_GET['id'])) {
  echo 'uploaded photo id is: '.$_GET['id'];
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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