{ "rates": { "CAD": 1.4491, "HKD": 8.577, "ISK": 137.4, "PHP": 56.092, "DKK": 7.473, "HUF": 336.01, "CZK": 25.16, "AUD": 1.6127, "RON": 4.7799, "SEK": 10.5363, "IDR": 15002.91, "INR": 78.67, "BRL": 4.6084, "RUB": 68.1692, "HRK": 7.4415, "JPY": 120.96, "THB": 33.723, "CHF": 1.0712, "SGD": 1.491, "PLN": 4.2565, "BGN": 1.9558, "TRY": 6.5539, "CNY": 7.6509, "NOK": 9.9375, "NZD": 1.6684, "ZAR": 15.8585, "USD": 1.1035, "MXN": 20.717, "ILS": 3.81, "GBP": 0.84313, "KRW": 1289.12, "MYR": 4.4857 }, "base": "EUR", "date": "2020-01-24" }
<?php /** * Created by PhpStorm. * User: FZS * Time: 2020/02/01 12:33 */ //---------------------------------- // 汇率与货币兑换率 调用类 //---------------------------------- class freeApi { private $apiUrl; public function __construct() { $this->apiUrl = 'https://api.exchangeratesapi.io/latest'; } /** * 获取结果 * @return array */ public function getResult() { return file_get_contents($this->apiUrl); } }