diff --git a/console/bin.php b/console/bin.php index 3a7cd66..d82aa72 100644 --- a/console/bin.php +++ b/console/bin.php @@ -1,58 +1,111 @@ -#!/usr/bin/php +#!/usr/bin/env php $value0) { + echo LINE_FEED.LINE_FEED."$key0 : "; + if (is_array($value0)) { + foreach ($value0 as $key1 => $value1) { + echo LINE_FEED.LINE_FEED."--$key1 : "; + if (is_array($value1)) { + foreach ($value1 as $key2 => $value2) { + echo LINE_FEED.LINE_FEED."----$key2 : "; + if (is_array($value2)) { + foreach ($value2 as $key3 => $value3) { + echo LINE_FEED.LINE_FEED."------$key3 : "; + if (is_array($value3)) { + print_r("------>".$value3. " : array"); + } else { + print_r("------>".$value3); + } + } + } else { + print_r("---->".$value2); + } + } + } else { + print_r("-->".$value1); + } + } + } else { + print_r($value0); + } + } + $write_string = ob_get_clean(); + file_put_contents(dirname(__DIR__) . DIRECTORY_SEPARATOR . "output" . DIRECTORY_SEPARATOR . ENV . DIRECTORY_SEPARATOR . "errors".$date->format("Y-m-d").".log", $write_string); + + return; + } +} diff --git a/console/component/Output.php b/console/component/Output.php new file mode 100644 index 0000000..9fa4b9b --- /dev/null +++ b/console/component/Output.php @@ -0,0 +1,38 @@ +format('d/m/Y H:i:s') . LINE_FEED; + echo $data . LINE_FEED; + $date_fin = new \DateTime('now'); + echo "# FIN ".$date_fin->format('d/m/Y H:i:s') . LINE_FEED; + + $csv_file = ob_get_clean(); + + //on insère la date du jour au début du nom de fichier + $name = $date_debut->format("Y-m-d-").$name; + + file_put_contents(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'output' . DIRECTORY_SEPARATOR . $name, $csv_file); + } +}