Http的请求类型:

Content-Type: application/x-www-form-urlencoded

数据格式比如:

mc_gross=399.00&protection_eligibility=Eligible&address_status=confirmed&payer_id=XEMQ4LGLL3E8U&address_street=%BF%C6%D4%B0%C2%B72%BA%C5A8%D2%F4%C0%D6%B4%F3%CF%C3&payment_date=22%3A41%3A18+Apr+04%2C+2017+PDT&payment_status=Completed&charset=gb2312&address_zip=518000&first_name=li&mc_fee=15.86&address_country_code=CN&address_name=%C9%EE%DB%DA%CA%D0%A1%A1%CA%A5%C2%EB%BF%C6%BC%BC&notify_version=3.8&custom=&payer_status=verified&business=yu.yu-facilitator%40zmartec.com&address_country=China&address_city=%C9%EE%DB%DA%CA%D0&quantity=1&verify_sign=AEPisTkyRVDN-DgDcwFo3PX0vGhVAHguYiojwSz3MswIw656jfrcaEIi&payer_email=zmartec%40zmartec.com&txn_id=47265043LY8373011&payment_type=instant&last_name=tao&address_state=GUANGDONG&receiver_email=yu.yu-facilitator%40zmartec.com&payment_fee=15.86&receiver_id=PEAD5Y5KWXRJU&txn_type=web_accept&item_name=SIGMA%2BSD1000&mc_currency=USD&item_number=&residence_country=US&test_ipn=1&transaction_subject=&payment_gross=399.00&ipn_track_id=d641e6445fbfc

转换为:

Array

PHP代码

          /**     * 表单类型数据转换成数组     * @param unknown $raw_post_array     */    function form_data_to_array($raw_post_array)    {        $raw_post_array = explode('&', $raw_post_array);        $myPost = array();        foreach ($raw_post_array as $keyval) {            $keyval = explode('=', $keyval);            if (count($keyval) == 2) {                // 转换urlencode的+为%2B                if ($keyval[0] === 'payment_date') {                    if (substr_count($keyval[1], '+') === 1) {                        $keyval[1] = str_replace('+', '%2B', $keyval[1]);                    }                }                $myPost[$keyval[0]] = urldecode($keyval[1]);            }        }    }

PS:

// 转换urlencode的+为%2B                if ($keyval[0] === 'payment_date') {                    if (substr_count($keyval[1], '+') === 1) {                        $keyval[1] = str_replace('+', '%2B', $keyval[1]);                    }                }                这段代码请根据自己的环境而定,我这里是有时区(Wed Apr 05 2017 14:37:18 GMT+0800)的加号。