UnityWebRequest发布得到未知响应

时间:2019-05-13 06:02:40

标签: c# unity3d unityscript

我正在将统一的邮寄请求发送到本地服务器,并且我设置了内容的类型,但该邮寄请求不可打印,显示出奇怪的地方。如果我不使用任何内容类型,则可以打印请求,但是我需要使用内容类型application/x-www-form-urlencoded; charset=UTF-8

     formData.Add(new MultipartFormDataSection("ig_sig_key_version=4&signed_body=62aebf432dabdb788be8f2d5449ca09514e4fb78591553ee88af22ac8b6a14ea.%7B%22device_id%22%3A%22android-d693d554e0ede0d75f7d2873b015f2286%22%2C%22guid%22%3A%2283d87ba58b994d1998be5df330377d66%22%2C%22username%22%3A%xxxxxx%40gmail.com%22%2C%22password%22%3A%22xxxxx%22%2C%22Content-Type%22%3A%22application%2Fx-www-form-urlencoded%3B+charset%3DUTF-8%22%7D"));


    UnityWebRequest www = UnityWebRequest.Post("http://localhost/log/test.php", formData);

    www.chunkedTransfer = false;
    www.uploadHandler.contentType = "application/x-www-form-urlencoded; charset=UTF-8";

    yield return www.SendWebRequest();
    Debug.Log(www.downloadHandler.text);

我得到的输出无法打印

  Array
   (
    [

   --GqHBbNKAAQ8E8nknl4DYZQmzN3aDDDccDL5DqfSM // This must not be part or request

   Content-Disposition:_form-data

   Content-Type:_text/plain;_encoding] => utf-8
  // This must not be part or request


    ig_sig_key_version=4
    [signed_body] => 62aebf432dabdb788be8f2d5449ca09514e4fb78591553ee88af22ac8b6a14ea.{"device_id":"android-d693d554e0ede0d75f7d2873b015f2286","guid":"83d87ba58b994d1998be5df330377d66","username":"xxxxxx@gmail.com","password":"xxxxxx","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}

  --GqHBbNKAAQ8E8nknl4DYZQmzN3aDDDccDL5DqfSM-- // This must not be part or request


 )

PHP侧面

 <?php
  print_r($_POST);

我需要这个回复

   [ig_sig_key_version] => 4
   [signed_body] => f722ea0761e497c7ff27eae5c583ff47ad074a5ff92e27e01ea23859006b4df6.{"device_id":"android-298f587406c914fad5373bb6893004332","guid":"6a1136d6b70b4f7ea57cfa5a3a707c5a","username":"xxxxxxx@gmail.com","password":"xxxxxxx","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}
  ) 

0 个答案:

没有答案