您的位置:首页 > 其它

curl get post请求

2016-07-27 13:19 211 查看
//多人pk赛
public function getGroupPK($uid,$type){
$data = array('uid'=>$uid,'type'=>$type);
$url = STATIC_KG_URL."gamedata?".http_build_query($data);
$ch = curl_init($url) ;
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true) ; // 获取数据返回
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true) ; // 在启用 CURLOPT_RETURNTRANSFER 时候将获取数据返回
$output = json_decode(curl_exec($ch),true);
return $output;
}


hp可以扮演资料的发送者。

简单的get

2. 简单的post

3. 高级的post,可设置多个参数

4. post 发送文件

发送端代码:

接收端代码:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: