本文整理匯總了PHP中League\Csv\Reader::setDelimiter方法的典型用法代碼示例。如果您正苦於以下問題:PHP Reader::setDelimiter方法的具體用法?PHP Reader::setDelimiter怎麽用?PHP Reader::setDelimiter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類League\Csv\Reader
的用法示例。
在下文中一共展示了Reader::setDelimiter方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* @param string $filePath Path to the csv file to read from
* @param string $delimiter The delimiter for the csv file
* @param string $enclosure The enclosure for the csv file
*/
public function __construct($filePath, $delimiter = ',', $enclosure = '"')
{
if (!is_file($filePath)) {
throw new LogicException(sprintf('The file %s does not exist. \\Plum\\PlumCsv\\CsvReader needs an existing csv to work with', $filePath));
}
$this->csv = Reader::createFromPath($filePath);
$this->csv->setFlags(\SplFileObject::READ_AHEAD | \SplFileObject::SKIP_EMPTY);
$this->csv->setDelimiter($delimiter);
$this->csv->setEnclosure($enclosure);
}
示例2: getReader
/**
*
* @return Reader
*/
public function getReader()
{
if (strlen($this->csvFileContent) === 0) {
$this->loadCsvFile();
}
if (is_null($this->reader)) {
$this->reader = Reader::createFromString($this->getCsvFileContent());
$this->reader->setDelimiter($this->delimiter);
}
return $this->reader;
}