importer_csv.php
Table of Contents
Functions
- importer_csv_importcharset() : array<string|int, mixed>
- Importer le charset d'une ligne
- importer_csv_nettoie_key() : string
- enlever les accents des cles presentes dans le head, sinon ca pose des problemes .
- inc_importer_csv_dist() : false|array<string|int, mixed>
- Lit un fichier csv et retourne un tableau si $head est true, la premiere ligne est utilisee en header pour generer un tableau associatif
Functions
importer_csv_importcharset()
Importer le charset d'une ligne
importer_csv_importcharset(string $texte[, bool|string $definir_charset_source = false ]) : array<string|int, mixed>
Importe un texte de CSV dans un charset et le passe dans le charset du site (utf8 probablement) Les CSV peuvent sous ms@@@ avoir le charset 'iso-8859-1', mais pasfois aussi 'windows-1252' :/
Parameters
- $texte : string
- $definir_charset_source : bool|string = false
-
false : ne fait rien string : utilisera pour les prochains imports le charset indiqué true : remet le charset d'import par défaut de la fonction
Return values
array<string|int, mixed>importer_csv_nettoie_key()
enlever les accents des cles presentes dans le head, sinon ca pose des problemes .
importer_csv_nettoie_key(string $key) : string
..
Parameters
- $key : string
Return values
stringinc_importer_csv_dist()
Lit un fichier csv et retourne un tableau si $head est true, la premiere ligne est utilisee en header pour generer un tableau associatif
inc_importer_csv_dist(string $file[, array<string|int, mixed> $options = [] ]) : false|array<string|int, mixed>
Parameters
- $file : string
- $options : array<string|int, mixed> = []
-
bool $head string $delim string $enclos int $len string $charset_source : Permet de définir un charset source du CSV, si différent de utf-8 ou iso-8859-1