PHP   发布时间:2022-04-04  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了货币换算的PHP脚本大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

我正在寻找一个进行货币换算的PHP脚本.

在哪里可以找到适用于codeigniter的工具?

解决方法:

取自http://www.ecb.europa.eu/stats/exchange/eurofxref/html/index.en.html#dev

How to parse the data
This is just an example

<?PHP
//This is a PHP (4/5) script example on how eurofxref-daily.xml can be parsed 

//Read eurofxref-daily.xml file in memory 
$XMLContent= file("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml");
//the file is updated daily between 2.15 p.m. and 3.00 p.m. CET

foreach ($XMLContent as $linE) {
        if (ereg("currency='([[:alpha:]]+)'",$line,$currencyCodE)) {
            if (ereg("rate='([[:graph:]]+)'",$line,$ratE)) {
                    //Output the value of 1 EUR for a currency code 
                    echo '1 &euro; = '.$rate[1].' '.$currencyCode[1].'<br />';
                    //--------------------------------------------------
                    // Here you can add your code for inserTing
                    // $rate[1] and $currencyCode[1] into your database
                    //--------------------------------------------------
            }
        }
}
?> 

不是最好的脚本,但是再一次,您只是要求提供gimme-teh-codez.

大佬总结

以上是大佬教程为你收集整理的货币换算的PHP脚本全部内容,希望文章能够帮你解决货币换算的PHP脚本所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: