【发布时间】:2018-10-09 06:27:31
【问题描述】:
我需要 php 编码来将美元转换为所有本地货币。我找到了很多链接 库存溢出,但他们不工作。特别是这个(https://www.google.com/finance/converter?a=$amount&from=$from&to=$to)链接不工作请解决我的问题
【问题讨论】:
标签: php codeigniter
我需要 php 编码来将美元转换为所有本地货币。我找到了很多链接 库存溢出,但他们不工作。特别是这个(https://www.google.com/finance/converter?a=$amount&from=$from&to=$to)链接不工作请解决我的问题
【问题讨论】:
标签: php codeigniter
使用google API在php中转换货币的简单方法
function currencyConverter($from_currency, $to_currency, $amount) {
$from_Currency = urlencode($from_currency);
$to_Currency = urlencode($to_currency);
$encode_amount = urlencode($amount);
$get = file_get_contents("https://www.google.com/finance/converter?a=$encode_amount&from=$from_Currency&to=$to_Currency");
$get = explode("<span class=bld>",$get);
$get = explode("</span>",$get[1]);
$converted_currency = preg_replace("/[^0-9\.]/", null, $get[0]);
return $converted_currency;
}
【讨论】: