使用file()函数将文件载入数组文件中的每一行作为数组的一个元素
实例
array_filephp:
view sourceprint?
<?php
$DOCUMENT_ROOT
=
$_SERVER
[
DOCUMENT_ROOT
];
?>
<html>
<head>
<title>TestArrayFile</title>
</head>
<body>
<?php
$peoples
=file(
$DOCUMENT_ROOT
/test//peopletxt
);
$count
=
count
(
$peoples
);
if
(
$count
==){
echo
NOpeoplespendingPleasetryagainlater
;
}
for
(
$i
=;
$i
<
$count
;
$i
++){
echo
$peoples
[
$i
]
<br/>
;
}
?>
</body>
</html>