diffnest / myblog

0 stars 0 forks source link

文本随机取样 #14

Open diffnest opened 6 years ago

diffnest commented 6 years ago
$filename = $argv[1];
$fd = fopen($filename, "rb");
while($line = fgets($fd)) {
        if (rand(1, 7) == 1) {
                echo $line;
        }
}
fclose($rd);