소스 검색

export filtered emails

master
Daniel 3 년 전
커밋
56675c7756
5개의 변경된 파일73819개의 추가작업 그리고 0개의 파일을 삭제
  1. +1
    -0
      .gitignore
  2. +52
    -0
      createExport.php
  3. +36476
    -0
      customer.csv
  4. +35913
    -0
      export.csv
  5. +1377
    -0
      filter.csv

+ 1
- 0
.gitignore 파일 보기

@@ -0,0 +1 @@
/.idea/

+ 52
- 0
createExport.php 파일 보기

@@ -0,0 +1,52 @@
<?php

$customerCsvPath = __DIR__ . '/customer.csv';
$filterCsvPath = __DIR__ . '/filter.csv';
$handle = fopen($customerCsvPath, 'r');

$i = 1;
$customers = [];
while ($data = fgetcsv ($handle, 1000, ";") ) {
if ($i !== 1) {
$row = array_map("utf8_encode", $data);
$customers[$row[0]] = array_map("utf8_encode", $data);
}
$i++;
}

$handle = fopen($filterCsvPath, 'r');

$i = 1;
$filterData = [];
while ($data = fgetcsv ($handle, 1000, ";") ) {
if ($i !== 1) {
$row = array_map("utf8_encode", $data);
if ($row[18] !== "") {
$filterData[$row[18]] = array_map("utf8_encode", $data);
}
}
$i++;
}

$countCustomers = count($customers);
$countFilters = count($filterData);

foreach ($filterData as $key => $value) {
if (array_key_exists($key, $customers)) {
unset($customers[$key]);
}
}

$countFilteredCustomers = count($customers);
if (file_exists(__DIR__ . '/export.csv')) {
unlink(__DIR__ . '/export.csv');
}

$fp = fopen('export.csv', 'w');
fputcsv($fp, ['EMAIL'], ';');
foreach ($customers as $email => $val) {
fputcsv($fp, [$email], ';');
}

fclose($fp);


+ 36476
- 0
customer.csv
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 35913
- 0
export.csv
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 1377
- 0
filter.csv
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


불러오는 중...
취소
저장