vendor/phpoffice/phpexcel/unitTests/testDataFileIterator.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

class testDataFileIterator implements Iterator
{

    protected $file;
    protected $key = 0;
    protected $current;

    public function __construct($file)
    {
        $this->file = fopen($file, 'r');
    }

    public function __destruct()
    {
        fclose($this->file);
    }

    public function rewind()
    {
        rewind($this->file);
        $this->current = $this->_parseNextDataset();
        $this->key = 0;
    }

    public function valid()
    {
        return !feof($this->file);
    }

    public function key()
    {
        return $this->key;
    }

    public function current()
    {
        return $this->current;
    }

    public function next()
    {
        $this->current = $this->_parseNextDataset();
        $this->key++;
    }

    private function _parseNextDataset()
    {
        //    Read a line of test data from the file
        do {
            //    Only take lines that contain test data and that aren't commented out
            $testDataRow = trim(fgets($this->file));
        } while (($testDataRow > '') && ($testDataRow{0} === '#'));

        //    Discard any comments at the end of the line
        list($testData) = explode('//',$testDataRow);

        //    Split data into an array of individual values and a result
        $dataSet = $this->_getcsv($testData, ',', "'");

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。