总结:

1、data数据格式

2、php post 格式无需json_encode(关联数组,所以可以绕弯)  参考:http://bbs.csdn.net/topics/390645553?page=1

python:

import requests

data={
    "xxx":xxx,
    "yyy":yyy,
}   
values = { "data":json.dumps(data) }
files = { 'isImg': open('test.jpg').read() }

res = requests.post("http://------------", data=values,files=files)
print(res.text);

php:

      $data = array(
            "xxx"=>$xxx,
            "yyy"=>$yyy,
        );

        $data =array(
            'data'=>json_encode($data),
            'isImg'=>"@$msg");

        $url = $this->url."-------";
        $ret = $this->_request($url,'POST',$data);

  //curl部分:

  //if($method=='POST'){
  //         curl_setopt($ch, CURLOPT_POST, 1);
  //         curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  //     }
posted on 2016-03-10 20:48  妞溜溜  阅读(459)  评论(0)    收藏  举报