时间:2021-07-01 10:21:17 帮助过:7人阅读
01.
02.
$DOCUMENT_ROOT
=
$_SERVER
[
'DOCUMENT_ROOT'
];
03.
?>
04.
05.
06.
Test Array File
07.
08.
09.
10.
$peoples
= file(
$DOCUMENT_ROOT
.
'/test/03/people.txt'
);
11.
$count
=
count
(
$peoples
);
12.
if
(
$count
== 0) {
13.
echo
'NO peoples pending. Please try again later.'
;
14.
}
15.
for
(
$i
= 0;
$i
<
$count
;
$i
++) {
16.
echo
$peoples
[
$i
].
'
'
;
17.
}
18.
?>
19.
20.
http://www.bkjia.com/PHPjc/371695.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/371695.htmlTechArticle使用file()函数将文件载入数组,文件中的每一行作为数组的一个元素。 实例: array_file.php: view sourceprint? 01. ?php 02. $DOCUMENT_ROOT = $_SERVER [ '...