// 文件的读取(一)
    function getLines($filename){
        $f = fopen($filename,'rb');
        try{
            while ($line = fgets($f)) {
                yield $line;
            }
        }finally{
            fclose($f);
        }
    }
    $lines = getLines('my.log');
    foreach($lines as $line){
        echo $line.PHP_EOL;
    }

    // 文件的读取(二)
    function getLiness($filename){
        $f = fopen($filename,'rb');
        try{
            while ($line = fgets($f)) {
                $lineParts = explode(' ',$line,2);
                yield $lineParts[0] => $lineParts[1];
            }
        }finally{
            fclose($f);
        }
    }

    foreach(getLiness('my.log') as $ip => $line){
        echo $ip.'=》'.$line.PHP_EOL;
    }

    // 大数组的构建
    function xrange($start,$end,$step=1){
        for ($i=$start; $i <= $end; $i+=$step) {
            yield $i;
        }
    }
    foreach (xrange(1,999) as $num) {
        echo $num,"\n";
    }