使用file()函數將文件載入數組
實例
array_file
<?php
$DOCUMENT_ROOT
=
$_SERVER
[
DOCUMENT_ROOT
];
?>
<html>
<head>
<title>Test Array File</title>
</head>
<body>
<?php
$peoples
= file(
$DOCUMENT_ROOT
/test/ /people txt
);
$count
=
count
(
$peoples
);
if
(
$count
== ) {
echo
NO peoples pending Please try again later
;
}
for
(
$i
= ;
$i
<
$count
;
$i
++) {
echo
$peoples
[
$i
]
<br />
;
}
?>
</body>
</html>
From:http://tw.wingwit.com/Article/program/PHP/201311/21133.html