首页 > 解决方案 > 将 POST 文本输出转换为 JSON

问题描述

我正在将 POST 转换为 JSON,然后保存到表中。不知何故,我的代码和查询不起作用,我还将 POST 输出文本发送到电子邮件中作为备份。我必须将丢失的 JSON 条目保存到表中。我有 JSON 格式,我可以手动将 POST 转换为 JSON,但这将非常耗时,而且我有很多数据需要保存。无论如何我可以将 POST 输出文本转换为 JSON 吗?

下面是我必须转换为 JSON 的 POST 输出文本。

Array ( [mc_gross] => 2.00 [protection_eligibility] => Ineligible [address_status] => confirmed [payer_id] => W92W4QGG4DPSE [tax] => 0.00 [address_street] => Street Park [payment_date] => 08:49:32 Oct 01, 2020 PDT [payment_status] => Pending [charset] => windows-1252 [address_zip] => 123456 [first_name] => John [address_country_code] => US [address_name] => Address name [notify_version] => 3.9 [custom] => 14673|2628|0|0 [payer_status] => verified [address_country] => US [address_city] => City [quantity] => 1 [verify_sign] => AYeK0nPD6ny3nwQhXIe-HRLjFsBxAbVcuekfRoqaw421iA6T6-9HuwOZ [payer_email] => ea9ym2967401@exampledomain.com [txn_id] => 7NK31954DJ9775812 [payment_type] => instant [last_name] => Doe [address_state] => State [receiver_email] => info@domain.com [shipping_discount] => 0.00 [insurance_amount] => 0.00 [pending_reason] => unilateral [txn_type] => web_accept [item_name] => US Open 2020 [discount] => 0.00 [mc_currency] => USD [item_number] => 23344 [residence_country] => US [test_ipn] => 1 [shipping_method] => Default [transaction_subject] => [payment_gross] => 2.00 [ipn_track_id] => 53d2891cbb8c1 ) 

标签: phpjson

解决方案


推荐阅读