解决方案 »

  1.   

    顺序输出
    $jieshaos = file("jieshaos.txt");
    foreach($jieshaos as $row) {
      echo $row . '<br>';
    }
    随机输出
    $jieshaos = file("jieshaos.txt");
    shuffle($jieshaos);
    foreach($jieshaos as $row) {
      echo $row . '<br>';
    }
      

  2.   

    rand是随机 ,  要递增   用for  while   foreach 都可以做到
      

  3.   

    输出一行:$jieshaos = file("jieshaos.txt");
    echo $jieshaos[0];
      

  4.   


    $file = 'test.txt';
    $data = file_get_contents($file);
    $content = explode(chr(10), $data);
    $len = count($content);
    echo $content[mt_rand(0,$len-1)];