Question about the loss of Php request parameters and Chinese garbled characters ??? Recently, due to the needs of the open platform project, I encountered some problems when writing the php sdk. I made a mark to avoid missing the question ??? The request parameters sent by Php are missing :? Curl_setopt ($ ch, CURLOPT_POSTFIELDS, Php request parameter loss and Chinese garbled characters
? ? ? Recently, due to the needs of the open platform project, I encountered some problems when writing the php sdk, so as not to forget it later.
?
? ? The request parameters sent by Php are missing:
? Curl_setopt ($ ch, CURLOPT_POSTFIELDS, substr ($ postBodyString, 0,-1 ));
? $ Reponse = curl_exec ($ ch );
? After the request arrives at the server, the postBodyString content does not appear in the request and the parameter is lost.
?
? ? Solution:
? ? Use the Header to perform the following settings:
? ? $ Headers = array ('Content-type: application/x-www-form-Urlencoded; Charset = UTF-8');?
??? Curl_setopt ($ ch, CURLOPT_HTTPHEADER, $ headers );
?
? ? In addition, if the returned results contain Chinese characters and garbled characters, you can use the above method.