Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CSV ma 3 kolumny.
- function getSignalCSV($url = 'https://defaulturltofile.csv')
- {
- $csvData = file_get_contents($url);
- $lines = explode(PHP_EOL, $csvData);
- //$lines = iconv("CP1251", "System", $lines);
- $csv = array();
- foreach ($lines as $key => $line) {
- $csv[] = str_getcsv($line, ';');
- }
- return $csv;
- }
- -----------------------------
- Z powyższego kodu otrzymuję coś takiego
- Array
- (
- [0] => Array
- (
- [0] => KDREFPRODUKT
- [1] => Jakiś tam produkt
- [2] => dostepny
- )
- [1] => Array
- (
- [0] => KDREFPRODUKT2
- [1] => Jakiś tam produkt 2
- [2] => niedostepny
- )
- )
- ---------------------------------------
- PYTANIE JEDNAK JEST JAK PRZY UŻYCIU str_getcsv zapisać te wartości do takiej postaci
- Array
- (
- [0] => Array
- (
- [ref] => KDREFPRODUKT
- [name] => Jakiś tam produkt
- [status] => dostepny
- )
- [1] => Array
- (
- [ref] => KDREFPRODUKT2
- [name] => Jakiś tam produkt 2
- [status] => niedostepny
- )
- )
Advertisement
Add Comment
Please, Sign In to add comment