(問)get請求會對中文及特殊字元進行轉碼

白小二發表於2021-04-15

java 那邊一直說獲取到的資料格式不對,但是我用 PHPcurl 跟瀏覽器請求並不會出現這種請款
get 請求的 url:

php_curl請求

請求程式碼

        $ch = curl_init();
        $url = "http://localhost/test?appSeriaNo=huawei202104151630003970&validateType=HUAN745&accountID=16550&validateParam=&termUnitParam=&appPayKey=pay20210409152753726&productName=中文認字&productCount=1&productDescribe=&productPrice=&orderType=rmb&date=20210415163001&noticeUrl=http://local.xiaohoumengqi.com/api/notify&noticeType=http&extension=&signType=72b6f4536b0be74f8ca48bb1ace75702&huanUserId=&wired_mac=&wireless_mac=&sign=&redirectUrl=http://local.xiaohoumengqi.com/huanwang/buy&sign=9fdde63c9a5755f01c5a3111b31099fc";
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
        $return = curl_exec($ch);
        curl_close($ch); 

接收程式碼、

    public function index(Request $request)
    {
        log::info($request->input());
    }

接受結果

[2021-04-15 16:30:01] local.INFO: array (
  'appSeriaNo' => 'huawei202104151630003970',
  'validateType' => 'HUAN745',
  'accountID' => '16550',
  'validateParam' => NULL,
  'termUnitParam' => NULL,
  'appPayKey' => 'pay20210409152753726',
  'productName' => '中文認字',
  'productCount' => '1',
  'productDescribe' => NULL,
  'productPrice' => NULL,
  'orderType' => 'rmb',
  'date' => '20210415163001',
  'noticeUrl' => 'http://localhost.com/huanwang/notify',
  'noticeType' => 'http',
  'extension' => NULL,
  'signType' => '72b6f4536b0be74f8ca48bb1ace75702',
  'huanUserId' => NULL,
  'wired_mac' => NULL,
  'wireless_mac' => NULL,
  'sign' => '9fdde63c9a5755f01c5a3111b31099fc',
  'redirectUrl' => 'http://localhost.com/huanwang/buy',
)  
本作品採用《CC 協議》,轉載必須註明作者和本文連結
保持專注

相關文章