php中json資料處理的問題

來源:互聯網
上載者:User
微店API推送的訂單資訊格式如下:

content={"message":{"seller_name":"天天向上","total":"0.10","express_fee":"0.00","buyer_identity_id":"0","f_phone":"","fx_fee_value":"0.00","express_type":null,"express_note":"","modify_price_enable":"1","express":null,"order_id":"774780580411340","order_type_des":"擔保交易","confirm_expire":"","group_status":-1,"send_time":null,"weixin":"","is_close":0,"argue_flag":0,"total_fee":"0.00","status_desc":"未付款","quantity":"1","note":"","trade_no":null,"sk":null,"status":"unpay","discount_info":"無優惠","seller_phone":"18512345678","express_fee_num":"0.00","pay_time":"","discount_amount":"0","discount":null,"real_income_price":"","price":"0.10","buyer_info":{"buyer_id":"1024799624","region":"禹會區","phone":"15923808761","post":null,"address":"安徽 蚌埠市 禹會區 城區回來了","name":"路過","self_address":"城區回來了","province":"安徽","city":"蚌埠"},"items":[{"is_delivered":0,"img":"http://wd.geilicdn.com/vshop1024697422-1476758240117-CE6F5-s1.jpg?w=110&h=110&cp=1","total_price":"0.10","merchant_code":"","deliver_id":"0","url":"http://weidian.com/i/1969988669","deliver_status_desc":"","price":"0.10","sku_merchant_code":"","item_name":"測試商品","item_id":"1969988669","fx_fee_rate":"0%","quantity":"1","can_deliver":1,"refund_info":{"refund_no":"","refund_fee":"0","refund_status_str":"","item_id":"1969988669","item_sku_id":"0","refund_status":"","refund_express_fee":"0","can_refund":"0","refund_item_fee":"0","refund_status_desc":""},"sku_id":"0","sku_title":null}],"user_phone":"15912345678","status2":"未付款","f_seller_id":"","seller_id":"1024697422","add_time":"2016-10-18 13:25:54","refund_info":{"buyer_refund_fee":null,"refund_time":null},"return_code":"","express_no":null,"f_shop_name":"","original_total_price":"","order_type":"3"},"type":"weidian.order.non_payment"}&public={"x_forwarded_for":null}

需要獲得其中某一個或者幾個欄位的資料,這裡有兩段json資訊,求問大神應該怎麼處理呢?

如果是

{"seller_name":"天天向上","total":"0.10","express_fee":"0.00","buyer_identity_id":"0","f_phone":"","fx_fee_value":"0.00","express_type":null,"express_note":"","modify_price_enable":"1","express":null,"order_id":"774780580411340"}

這樣的格式,應該下面的代碼就可以

回複內容:

微店API推送的訂單資訊格式如下:

content={"message":{"seller_name":"天天向上","total":"0.10","express_fee":"0.00","buyer_identity_id":"0","f_phone":"","fx_fee_value":"0.00","express_type":null,"express_note":"","modify_price_enable":"1","express":null,"order_id":"774780580411340","order_type_des":"擔保交易","confirm_expire":"","group_status":-1,"send_time":null,"weixin":"","is_close":0,"argue_flag":0,"total_fee":"0.00","status_desc":"未付款","quantity":"1","note":"","trade_no":null,"sk":null,"status":"unpay","discount_info":"無優惠","seller_phone":"18512345678","express_fee_num":"0.00","pay_time":"","discount_amount":"0","discount":null,"real_income_price":"","price":"0.10","buyer_info":{"buyer_id":"1024799624","region":"禹會區","phone":"15923808761","post":null,"address":"安徽 蚌埠市 禹會區 城區回來了","name":"路過","self_address":"城區回來了","province":"安徽","city":"蚌埠"},"items":[{"is_delivered":0,"img":"http://wd.geilicdn.com/vshop1024697422-1476758240117-CE6F5-s1.jpg?w=110&h=110&cp=1","total_price":"0.10","merchant_code":"","deliver_id":"0","url":"http://weidian.com/i/1969988669","deliver_status_desc":"","price":"0.10","sku_merchant_code":"","item_name":"測試商品","item_id":"1969988669","fx_fee_rate":"0%","quantity":"1","can_deliver":1,"refund_info":{"refund_no":"","refund_fee":"0","refund_status_str":"","item_id":"1969988669","item_sku_id":"0","refund_status":"","refund_express_fee":"0","can_refund":"0","refund_item_fee":"0","refund_status_desc":""},"sku_id":"0","sku_title":null}],"user_phone":"15912345678","status2":"未付款","f_seller_id":"","seller_id":"1024697422","add_time":"2016-10-18 13:25:54","refund_info":{"buyer_refund_fee":null,"refund_time":null},"return_code":"","express_no":null,"f_shop_name":"","original_total_price":"","order_type":"3"},"type":"weidian.order.non_payment"}&public={"x_forwarded_for":null}

需要獲得其中某一個或者幾個欄位的資料,這裡有兩段json資訊,求問大神應該怎麼處理呢?

如果是

{"seller_name":"天天向上","total":"0.10","express_fee":"0.00","buyer_identity_id":"0","f_phone":"","fx_fee_value":"0.00","express_type":null,"express_note":"","modify_price_enable":"1","express":null,"order_id":"774780580411340"}

這樣的格式,應該下面的代碼就可以

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.