且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用PHP从文本文件中读取行

更新时间:2023-01-23 13:54:14


大家好,我是新来的。嗯......你能帮我解决这个问题......从文本文件中读取行的代码是什么。谢谢=)
Hello everyone, i am new here. Hmm...can you all please help me with this..what is the code for reading lines from a text file..Thanks =)



你好, Fab108 欢迎来到 TSDN


试试这些教程


感谢您的帮助,但fgets帮助我们获得第一个例如我的文本文件是


数据记录:

日期:2007/6/11

时间:13:9: 3

设备ID:B108

关于总数:001891

================ ===

=====================

记录:1

活动类型:3

年份:2007

月:6

日:7

小时:5

分钟:9

第二名:37.527237


我只想从年份开始显示,我该怎么做使用fgets做什么?
Thanks for your help, but fgets help us to get the first line for example my text file is

Datalogs:
Date: 2007/6/11
Time: 13:9:3
Device ID: B108
About total Numbers: 001891
===================
=====================
Record: 1
Event Type: 3
Year: 2007
Month: 6
Day: 7
Hour: 5
Minute: 9
Second: 37.527237


And i only want to display from Year onwards, how do i do that using fgets?



Tha请求帮助,但fgets帮助我们获得第一行,例如我的文本文件是


Datalogs:

日期:2007/6/11

时间:13:9:3

设备ID:B108

关于总数:001891

=== ================

=====================

记录:1

活动类型:3

年份:2007

月份:6

日: 7

小时:5

分钟:9

秒:37.527237


而且我只想从年份开始显示,我如何使用fgets做到这一点?
Thanks for your help, but fgets help us to get the first line for example my text file is

Datalogs:
Date: 2007/6/11
Time: 13:9:3
Device ID: B108
About total Numbers: 001891
===================
=====================
Record: 1
Event Type: 3
Year: 2007
Month: 6
Day: 7
Hour: 5
Minute: 9
Second: 37.527237


And i only want to display from Year onwards, how do i do that using fgets?



我没有要求只使用 fgets()。我提供的搜索结果的教程数量很多。

还有一件事,如果你想从文本文件中读取这些值,每条记录都应该有一个特定的格式。

例子:

I didn''t ask to use just only the fgets().There were number of tutorials on the search result that i supplied.
And one more thing if you want to read this values from a text file there should be a specific format for each and every record.

example:

展开 | 选择 | Wrap | 行号