将数据从二进制文件解码/读取到(a)数组中 [英] Decoding/reading data from a binary file into (an) array(s)
问题描述
你好。
我需要能够从附件中提取数据(或
中相同格式的任何文件)以便我可以使用PHP中的数据。我很擅长将PHP与数据库,数组等一起使用,但是没有用二进制数据文件工作
。
< a rel =nofollowhref =http://www.performancecentral.net/C...3Loop/3Loop.phptarget =_ blank> http://www.performancecentral.net/C...3Loop /3Loop.php
点击下载表现。
好消息是我至少知道大多数文件
包含b / c的信息创建文件的程序将导出到csv文件
(包含在此消息的底部)。
请帮忙。我尝试使用HHD十六进制编辑器阅读,但未能能够做出任何结果。我知道数据没有加密,但它显然是以某种方式编码的b $ b所以我主要需要弄清楚如何解码或
有人为我解码它。请帮忙。
提前致谢。 csv文件文本如下:
[用户数据]
Ray
年龄= 44
重量= 85.7千克
LOWER HR = 60
UPPER HR = 221
[最终用户数据]
记录数= 913
ms速度瓦特rpm hr ss lss rss lpwr rpwr英里风级负载
" 0"," 0.00"," 0"," 0"," 100"," 99 QUOT;," 99 QUOT;," 99 QUOT;," 50 QUOT;," 49 QUOT;," 0.0000"," 0","
0.00"," 0"
" 374"," 2.76"," 4英寸," 0"," 100"," 99 QUOT;," 99 QUOT;," 99 QUOT;," 50 QUOT;," 49 QUOT;," 0.0001,
0"," 0.00"," 0"
" 541"," 2.76"," 4英寸," 0"," 100"," 99 QUOT;," 99 QUOT;," 99 QUOT;," 50 QUOT;," 49 QUOT;," 0.0001,
0"," 0.00"," 0"
" 559"," 2.76"," 4英寸," 0"," 100"," 99 QUOT;," 99 QUOT;," 99 QUOT;," 50 QUOT;," 49 QUOT;," 0.0001,
0"," 0.00"," 0"
" 593"," 7.08"," 4英寸," 0"," 100"," 99 QUOT;," 99 QUOT;," 99 QUOT;," 50 QUOT;," 49 QUOT;," 0.0002,
0"," 0.00"," 0"
" 629"," 7.08"," 4英寸," 0"," 100"," 99 QUOT;," 99 QUOT;," 99 QUOT;," 50 QUOT;," 49 QUOT;," 0.0001,
0"," 0.00"," 0"
" 646"," 7.08"," 4英寸," 0"," 100"," 99 QUOT;," 99 QUOT;," 99 QUOT;," 50 QUOT;," 49 QUOT;," 0.0001,
0"," 0.00"," 0"
" 680"," 7.08"," 4英寸," 0"," 100"," 99 QUOT;," 99 QUOT;," 99 QUOT;," 50 QUOT;," 49 QUOT;," 0.0004","
0"," 0.00"," 0"
" 733"," 7.08"," 4英寸," 0"," 100"," 99 QUOT;," 99 QUOT;," 99 QUOT;," 50 QUOT;," 49 QUOT;," 0.0004","
0"," 0.00"," 0"
" 733"," 7.08"," 4英寸," 0"," 100"," 99 QUOT;," 99 QUOT;," 99 QUOT;," 50 QUOT;," 49 QUOT;," 0.0005","
0"," 0.00"," 0"
" 769"," 7.08"," 4英寸," 0"," 100"," 99 QUOT;," 99 QUOT;," 99 QUOT;," 50 QUOT;," 49 QUOT;," 0.0005 QUOT;," 0",
" 0.00"," 0"
Hello.
I need to be able to extract the data from the attached file (or any file in
the same format) so that I can work with the data in PHP. I''m fairly
comfortable with using PHP with databases, arrays, etc. but have not worked
with binary data files.
http://www.performancecentral.net/C...3Loop/3Loop.php
click on "Download Performance".
The good news is that I know at least most of the information the file
contains b/c the program that created the file will export to a csv file
(included at the bottom of this message).
Please help. I tried to read using HHD hex editor, but failed to be able to
make anything of it. I do know that the data is not encrypted, but it is
obviously encoded somehow so I primarily need to figure out how to decode or
have someone decode it for me. Please help.
Thanks in advance. The csv file text follows:
[USER DATA]
Ray
AGE=44
WEIGHT=85.7 kg
LOWER HR=60
UPPER HR=221
[END USER DATA]
number of records = 913
ms speed watts rpm hr ss lss rss lpwr rpwr miles wind grade load
" 0"," 0.00"," 0"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0000"," 0","
0.00"," 0"
" 374"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0001","
0"," 0.00"," 0"
" 541"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0001","
0"," 0.00"," 0"
" 559"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0001","
0"," 0.00"," 0"
" 593"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0002","
0"," 0.00"," 0"
" 629"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0001","
0"," 0.00"," 0"
" 646"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0001","
0"," 0.00"," 0"
" 680"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0004","
0"," 0.00"," 0"
" 733"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0004","
0"," 0.00"," 0"
" 733"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0005","
0"," 0.00"," 0"
" 769"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0005"," 0",
" 0.00"," 0"
推荐答案
这里有一种方法,也有一些csv功能呢
here is one way, there is also some csv functions too
>
aryFile = file(" the_file_name.csv");
//逐行循环
foreach(
aryFile = file("the_file_name.csv");
// loop line by line
foreach (
aryFile as
aryFile as
这篇关于将数据从二进制文件解码/读取到(a)数组中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!