Answer the question
In order to leave comments, you need to log in
Parsing csv with a tab delimiter does not work - why?
require_once ($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/csv_data.php");
$csvFile = new CCSVData('R', true);
$csvFile->LoadFile($_SERVER["DOCUMENT_ROOT"] . '/upload/min.csv');//Файл
$csvFile->SetDelimiter('\t'); //разделитель
$bFirstHeaderTmp = $csvFile->GetFirstHeader(); //Заголовок
while ($arRes = $csvFile->Fetch()) { //Перебор CSV файла по полям
$arRes = $GLOBALS["APPLICATION"]->ConvertCharsetArray($arRes, "WINDOWS-1251", SITE_CHARSET);
echo '<pre>';
print_r($arRes);
echo '</pre>';
}
Array
(
[0] => TRANSMASTER UNIVERSAL 45100I Труба гофрированная универсальная 45X100 ШТУКА 1 336,9 4
)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question