dongqiao1888 2016-04-12 10:54
浏览 77
已采纳

如何从magento中的数组中获取单个对象值?

i am trying to calculate shipping charge and i am getting a response from REST API. i want to get return the value of "delivery_charges" form response array?

Array
(
[response] => Array
    (
        [delivery_charges] => 41
        [return_charges] => 83
        [all_charges] => Array
            (
                [DL] => 32
                [FS] => 30
                [DTO] => 0
                [RTO] => 32
                [ST] => 14.5
                [COD] => 0
                [TDS] => 0
                [CARD] => 0
                [CNC] => 0
            )

        [canc_charges] => 0
        [pickup_charges] => 0
        [params] => Array
            (
                [md] => E
                [pt] => prepaid
                [cl] => xxxxxxx
                [o_pin] => 560076
                [d_pin] => 560062
                [token] => xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                [gm] => 100
                [d_city] => Bangalore
                [o_city] => Bangalore
            )

    )

)

  • 写回答

2条回答 默认 最新

  • douyi1855 2016-04-12 13:00
    关注

    i got answer by just using

    return $shipping_charge['response']['delivery_charges'];
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 工控机出现散热器转一下停一下这种情况,是什么原因造成的
  • ¥15 双显卡,启动docker容器报错。
  • ¥15 想编写一个期货跨期套利的程序
  • ¥15 一个线程在sleep的时候set一个信号会起作用吗
  • ¥100 需求高精度PT100设计电路和算法
  • ¥15 单片机配网,继电器开关,广播
  • ¥60 Qcustomplot绘制实时动态曲线
  • ¥20 运用matlab画x-y图
  • ¥15 用idea运行项目,运行tomcat报错:断言失败
  • ¥15 Sqlserver查询链接服务器数据问题