//按行读取当前文件夹下的txt,并返回数组形式的数据
function getTxtArray( $txtFileName ) {
$txtFile = fopen( $txtFileName, 'r' );
$txtArray = array();
if ( !$txtFile ) {
fclose( $txtFile );
return $txtArray;
//读取失败返回空的数组
} else {
$indexTxtRow = 0;
while ( !feof( $txtFile ) ) {
$txtArray[$indexTxtRow] = fgets( $txtFile );
$indexTxtRow = $indexTxtRow + 1;
}
}
fclose( $txtFile );
return $txtArray;
}