从没有节点号的数组PHP中获取数据

时间:2018-10-03 08:12:06

标签: php arrays file-get-contents

早上好,如何从该数组获取数据?

Array
(
   [input] => Array
    (
        [account] => XXXXX
        [mass] => 0.6
        [quantity] => 5
        [length] => 15
        [width] => 15
        [height] => 15
        [to_town] => Somerset West
        [from_town] => Honeydew
        [delivery_type] => D/D
        [cod] => 
        [response_type] => 
        [town_strict] => 
    )

[to_town_valid] => Y
[from_town_valid] => Y
[result] => Success
[amount] => Array
    (
        [rate] => UQ
        [chargeable_mass] => 3.38
        [excl_vat] => 250.43
        [incl_vat] => 287.99
        [cod_charge] => 0
        [fuel_surcharge] => 54.17
        [volumetric] => 5000.00
        [delivery_surcharge] => 0.00
        [packaging_surcharge] => 0.00
        [vat] => 46.00
        [total] => 350.29
    )

)

1


我的代码如下,但不起作用:(

$myurl = "http://timefreight.co.za/collection/api/rates_api_block.php?account={$key}&mass={$mas}&quantity={$qa}&length={$len}&width={$wid}&height={$hei}&to_town={$to}&from_town={$fro}&delivery_type=D/D";

$results = file_get_contents($myurl);

return $results['amount']['total'];
  

我尝试了$ result = json_decode($ results,true);但它什么也没返回:(

任何帮助将不胜感激!

0 个答案:

没有答案