[英]PHP Excel Reader & Currency
I'm using php excel reader for upload data to db from xls files. 我正在使用php excel阅读器将数据从xls文件上传到db。
I have a field with a currency ( € 245,78 ) and I can't read with my tool. 我有一个使用货币的字段(245,78欧元),无法使用我的工具阅读。
If I use this code: 如果我使用此代码:
$get_data_ab = utf8_encode($data->val(4,6,$sheet_def));
the result is: 结果是:
¬ 246246246246.246246
If I use: 如果我使用:
$get_data_ab = $data->val(4,6,$sheet_def);
the result is empty. 结果为空。
What is wrong? 怎么了? How can I charge the € values in a variable? 如何在变量中收取€值?
After many researches i found the fix method, i paste it here for who encounter the same problem. 经过大量研究后,我找到了修复方法,将其粘贴到此处以查找遇到相同问题的人。
The first thing to do is "add" a true value to the definition of the file: 要做的第一件事是将真实值“添加”到文件的定义中:
$data = new Spreadsheet_Excel_Reader($nome_file,true);
After for read a custom number as € 245,78 you have to use this 读取自定义号码为€245,78后,您必须使用此号码
$get_data_ab = number_format($data->raw(4, 6, $sheet_def), 2);
Hope it helps someone ! 希望它能对某人有所帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.