我有这样的代码。 但是问题是为什么不能输出...请给出建议,这段代码有什么问题
<?php
function randLine($fileName) {
$fh = @fopen($fileName, "r");
while (true) {
$line = fgets($fh);
if ($line == null) {
break;
}
}
fclose($fh);
return $line;
}
$tes = randLine("list.txt");
$tes = str_replace(array("\n", "\r"), "", $tes);
echo $tes;