ソースを参照

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
ファイル差分が大きすぎるため省略します
ファイルの表示


読み込み中…
キャンセル
保存