我可能有一个奇怪的问题:
我正在网上的任何地方使用标准的Paypal PDT请求代码
SUCCESS mc_gross=23.50 protection_eligibility=Eligible address_status=confirmed payer_id=S9H3YCCR9VKX2 tax=3.50 address_street=1+Maire-Victorin payment_date=17%3A07%3A00+Aug+14%2C+2015+PDT payment_status=Completed charset=windows-1252 address_zip=M5A+1E1 first_name=John mc_fee=0.98 address_country_code=CA address_name=John+Snow custom=2%2Csingle payer_status=verified business=John+Snow%40gmail.com address_country=Canada address_city=Toronto quantity=1 payer_email=John+Snow%40hotmail.com txn_id=7KE02601B8442143K payment_type=instant last_name=Dubey address_state=Ontario receiver_email=John+Snow%40gmail.com payment_fee= receiver_id=H3JF3H2DJ7EKG txn_type=web_accept item_name=Est+soluta+consequatur+qui+et+sint+quisquam. mc_currency=CAD item_number= residence_country=CA handling_amount=0.00 transaction_subject=2%2Csingle payment_gross= shipping=0.00
除了解析之外,一切都有效:
似乎响应返回一个带空格而不是换行符的字符串“\ n”
$lines = explode(" ", $res);
我尝试将解析逻辑更改为:
Array()
在这种情况下我得到一个空数组:(
{ "results": [
{
"createdAt": "2015-07-07T15:57:07.299Z",
"name": "Actividades Mayo",
"objectId": "N8RI64iJO8",
"bool": false,
"updatedAt": "2015-08-13T17:25:03.838Z",
here goes the image url-> "image": "https://sample.com/images/animage.jpg"
}
]}
答案 0 :(得分:0)
我遇到了同样的问题,但对于我来说,以\ n \ r或两者以任何顺序爆炸都没有用。 因此,我离开了PHP,并使用nl2br自动为我完成此操作。然后我在br爆炸了。
$response=nl2br($response);
$response=explode('<br />',$response);