How does PHPCURL support multi-dimensional array transfer?

Source: Internet
Author: User
How does PHPCURL support multi-dimensional array transfer? $ _ GetData [& #039; test & #039;] [& #039; name & #039;] [& #039; ec & #039;] & #039; egeer & #039; {code ...} http_build_query: this function can only support 3-dimensional arrays. Write four-dimensional arrays $ _ getData [& #039; test & #039;] [& #039; name & #039;] [& #039; ec & #039;] [& #039; php & #039;] & #039; egeer & #039 ;; how does php curl support multi-dimensional array transfer?

$ _ GetData ['test'] ['name'] ['EC'] = 'eger ';

// Curl GET + POST submit public function filePostContents ($ url, $ data) {$ ch = curl_init (); curl_setopt ($ ch, CURLOPT_URL, $ url ); curl_setopt ($ ch, CURLOPT_POST, 1); curl_setopt ($ ch, CURLOPT_COOKIESESSION, 1); curl_setopt ($ ch, scheme, http_build_query ($ data); curl_setopt ($ ch, CURLOPT_TIMEOUT, 600); // curl_setopt ($ ch, CURLOPT_USERAGENT, _ USERAGENT _); // curl_setopt ($ ch, CURLOPT_REFERER, _ REFERER _); curl_setopt ($ ch, expires, expires, 1); $ r = curl_exec ($ ch); curl_close ($ ch); return $ r ;}

Http_build_query: this function can only support 3-dimensional arrays.

Write a four-dimensional array $ _ getData ['test'] ['name'] ['EC'] ['php'] = 'eger ';
Cannot use string offset as an array I

Reply content:

How does php curl support multi-dimensional array transfer?

$ _ GetData ['test'] ['name'] ['EC'] = 'eger ';

// Curl GET + POST submit public function filePostContents ($ url, $ data) {$ ch = curl_init (); curl_setopt ($ ch, CURLOPT_URL, $ url ); curl_setopt ($ ch, CURLOPT_POST, 1); curl_setopt ($ ch, CURLOPT_COOKIESESSION, 1); curl_setopt ($ ch, scheme, http_build_query ($ data); curl_setopt ($ ch, CURLOPT_TIMEOUT, 600); // curl_setopt ($ ch, CURLOPT_USERAGENT, _ USERAGENT _); // curl_setopt ($ ch, CURLOPT_REFERER, _ REFERER _); curl_setopt ($ ch, expires, expires, 1); $ r = curl_exec ($ ch); curl_close ($ ch); return $ r ;}

Http_build_query: this function can only support 3-dimensional arrays.

Write a four-dimensional array $ _ getData ['test'] ['name'] ['EC'] ['php'] = 'eger ';
Cannot use string offset as an array I

Why do we need to pass multi-dimensional arrays, convert them to json, and convert them to arrays when accepting them?

Multi-dimensional arrays cannot be passed.
This structure is amazing.
Upload the data in json as described above ~~

First into a string, if the field also pay attention to the format

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.