doufeng3602
2016-04-15 10:39
浏览 80
已采纳

发送Facebook图片网址作为参数

Facebook image url for user profile looks like

https://scontent.xx.fbcdn.net/hprofile-xfa1/v/t1.0-1/c26.26.321.321/s50x50/1004031_160695494109373_202362495_n.jpg?oh=bc24275f3c0b63adcd7f2

I want to send this url in request to server

$FBImageUrl = "https://scontent.xx.fbcdn.net/hprofile-xfa1/v/t1.0-1/c26.26.321.321/s50x50/1004031_160695494109373_202362495_n.jpg?oh=bc24275f3c0b63adcd7f2";
$postString = "http://example.com/script.php?img_url=" . FBImageUrl;

But what will happen if this url have question mark inside?

图片转代码服务由CSDN问答提供 功能建议

用户个人资料的Facebook图片网址如下所示

  https:  //scontent.xx.fbcdn.net/hprofile-xfa1/v/t1.0-1/c26.26.321.321/s50x50/1004031_160695494109373_202362495_n.jpg?oh=bc24275f3c0b63adcd7f2
  
 \  n 

我想将此URL请求发送到服务器

  $ FBImageUrl =“https://scontent.xx.fbcdn.net/hprofile-xfa1/v/  t1.0-1 / c26.26.321.321 / s50x50 / 1004031_160695494109373_202362495_n.jpg?oh = bc24275f3c0b63adcd7f2“; 
 $ postString =”http://example.com/script.php?img_url=“。  FBImageUrl; 
   
 
 

但是如果这个网址里面有问号会怎么样?

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • dongshi7350 2016-04-15 10:45
    已采纳

    use urlencode()

    $FBImageUrl = "https://scontent.xx.fbcdn.net/hprofile-xfa1/v/t1.0-1/c26.26.321.321/s50x50/1004031_160695494109373_202362495_n.jpg?oh=bc24275f3c0b63adcd7f2";
    $postString = "http://example.com/script.php?img_url=".urlencode($FBImageUrl) ;
    

    In your script.php

    $img_url = urldecode($_GET['img_url']);
    
    评论
    解决 无用
    打赏 举报
  • 查看更多回答(2条)

相关推荐 更多相似问题