收藏
回答

小游戏post请求,不同手机有概率出现数据为空的情况?

微信版本号:8.0.4

基础库版本:2.16.0

APPID:wx5dabc6b38370541e

IDE版本:1.05.2103190

服务端环境:centos7 php5.4

出现问题:

客户端发送post请求后,服务端会出现获取不到的post数据情况.

发送请求时已经加上 "Content-Type","application/x-www-form-urlencoded" .

现象:

手机A,系统版本IOS14.4.2,发送post请求.服务端正常收到并解析post数据.

手机B,系统版本IOS14.4.1,发送post请求,服务端收到请求但是无法获取到post数据.

服务端代码:

$data = file_get_contents("php://input");

请问这种问题要怎么处理?

回答关注问题邀请回答
收藏

1 个回答

  • 烟卷
    烟卷
    2021-04-10

    服务端抓取数据错误数据:

      3 array (

      4   'USER' => 'nobody',

      5   'HOME' => '/',

      6   'FCGI_ROLE' => 'RESPONDER',

      7   'SCRIPT_FILENAME' => '/data/www/game/ccbp/server/p7_alpha/public/s1/index.php',

      8   'QUERY_STRING' => '',

      9   'REQUEST_METHOD' => 'POST',

     10   'CONTENT_TYPE' => 'application/x-www-form-urlencoded',

     11   'CONTENT_LENGTH' => '0',

     12   'SCRIPT_NAME' => '/p7_alpha/public/s1/index.php',

     13   'REQUEST_URI' => '/p7_alpha/public/s1/index.php',

     14   'DOCUMENT_URI' => '/p7_alpha/public/s1/index.php',

     15   'DOCUMENT_ROOT' => '/data/www/game/ccbp/server',

     16   'SERVER_PROTOCOL' => 'HTTP/1.1',

     17   'HTTPS' => 'on',

     18   'GATEWAY_INTERFACE' => 'CGI/1.1',

     19   'SERVER_SOFTWARE' => 'nginx/1.8.0',

     20   'REMOTE_ADDR' => '218.66.157.218',

     21   'REMOTE_PORT' => '60732',

     22   'SERVER_ADDR' => '10.23.214.205',

     23   'SERVER_PORT' => '443',

     24   'SERVER_NAME' => 'ccbph5-api.wanxiami.cn',

     25   'REDIRECT_STATUS' => '200',

     26   'HTTP_HOST' => 'ccbph5-api.wanxiami.cn',

     27   'HTTP_CONNECTION' => 'keep-alive',

     28   'HTTP_CONTENT_LENGTH' => '0',

     29   'HTTP_CONTENT_TYPE' => 'application/x-www-form-urlencoded',

     30   'HTTP_ACCEPT_ENCODING' => 'gzip,compress,br,deflate',

     31   'HTTP_USER_AGENT' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.4(0x18000423) NetType/WIFI Language/zh_CN',

     32   'HTTP_REFERER' => 'https://servicewechat.com/wx5dabc6b38370541e/0/page-frame.html',

     33   'PHP_SELF' => '/p7_alpha/public/s1/index.php',

     34   'REQUEST_TIME_FLOAT' => 1618037841.7265279,

     35   'REQUEST_TIME' => 1618037841,



    服务端抓取正确日志:

     41   'USER' => 'nobody',

     42   'HOME' => '/',

     43   'FCGI_ROLE' => 'RESPONDER',

     44   'SCRIPT_FILENAME' => '/data/www/game/ccbp/server/p7_alpha/public/s1/index.php',

     45   'QUERY_STRING' => '',

     46   'REQUEST_METHOD' => 'POST',

     47   'CONTENT_TYPE' => 'application/x-www-form-urlencoded',

     48   'CONTENT_LENGTH' => '230',

     49   'SCRIPT_NAME' => '/p7_alpha/public/s1/index.php',

     50   'REQUEST_URI' => '/p7_alpha/public/s1/index.php',

     51   'DOCUMENT_URI' => '/p7_alpha/public/s1/index.php',

     52   'DOCUMENT_ROOT' => '/data/www/game/ccbp/server',

     53   'SERVER_PROTOCOL' => 'HTTP/1.1',

     54   'HTTPS' => 'on',

     55   'GATEWAY_INTERFACE' => 'CGI/1.1',

     56   'SERVER_SOFTWARE' => 'nginx/1.8.0',

     57   'REMOTE_ADDR' => '59.57.152.138',

     58   'REMOTE_PORT' => '4122',

     59   'SERVER_ADDR' => '10.23.214.205',

     60   'SERVER_PORT' => '443',

     61   'SERVER_NAME' => 'ccbph5-api.wanxiami.cn',

     62   'REDIRECT_STATUS' => '200',

     63   'HTTP_HOST' => 'ccbph5-api.wanxiami.cn',

     64   'HTTP_CONTENT_TYPE' => 'application/x-www-form-urlencoded',

     65   'HTTP_ACCEPT_ENCODING' => 'gzip, deflate, br',

     66   'HTTP_CONNECTION' => 'keep-alive',

     67   'HTTP_ACCEPT' => '*/*',

     68   'HTTP_USER_AGENT' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_4_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.4(0x18000423) NetType/WIFI Language/zh_CN',

     69   'HTTP_REFERER' => 'https://servicewechat.com/wx5dabc6b38370541e/0/page-frame.html',

     70   'HTTP_CONTENT_LENGTH' => '230',

     71   'HTTP_ACCEPT_LANGUAGE' => 'zh-cn',

     72   'PHP_SELF' => '/p7_alpha/public/s1/index.php',

     73   'REQUEST_TIME_FLOAT' => 1618038038.8492811,

     74   'REQUEST_TIME' => 1618038038,




    2021-04-10
    有用
    回复
登录 后发表内容
问题标签