帮我用PHP解析此文件 [英] Help me parse this file with PHP

查看:55
本文介绍了帮我用PHP解析此文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


Fri Nov 27 10:00:01 EST 2009         974        12506
Fri Nov 27 11:00:01 EST 2009         988        12655
Fri Nov 27 12:00:01 EST 2009        1005        12886
Fri Nov 27 13:00:01 EST 2009        1026        13115
Fri Nov 27 14:00:01 EST 2009        1042        13429

我尝试先爆炸\ n,然后爆炸\ t,但文件中似乎没有标签...

I tried to explode on \n and then \t, but it looks like there are no tabs in the file...

推荐答案

这将在所有空白集合中拆分,无论大小如何.

This'll split at all whitespace collections, regardless of size.

$lines = file($myfile);
foreach ($lines as $line) {
    $line = preg_split('/\s+/', $line);
    # do stuff with line
}

这篇关于帮我用PHP解析此文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆