README.md: Fix incorrect constructor usage

This commit is contained in:
Fonata
2021-05-03 21:26:56 +02:00
committed by GitHub
parent b444afae2f
commit be01bc9ae4

View File

@@ -53,14 +53,7 @@ To use ParseCSV, you then have to add a `require 'parsecsv.lib.php';` line.
## Example Usage ## Example Usage
**General parsing** **Parse a tab-delimited CSV file with encoding conversion**
```php
$csv = new \ParseCsv\Csv('data.csv');
print_r($csv->data);
```
**Tab delimited, and encoding conversion**
```php ```php
$csv = new \ParseCsv\Csv(); $csv = new \ParseCsv\Csv();
@@ -70,7 +63,7 @@ $csv->parseFile('data.tsv');
print_r($csv->data); print_r($csv->data);
``` ```
**Auto-detect delimiter character** **Auto-detect field delimiter character**
```php ```php
$csv = new \ParseCsv\Csv(); $csv = new \ParseCsv\Csv();
@@ -152,6 +145,8 @@ $csv->save('data.csv', array(array('1986', 'Home', 'Nowhere', '')), /* append */
**Convert 2D array to CSV data and send headers to browser to treat output as **Convert 2D array to CSV data and send headers to browser to treat output as
a file and download it** a file and download it**
Your web app users would call this an export.
```php ```php
$csv = new \ParseCsv\Csv(); $csv = new \ParseCsv\Csv();
$csv->linefeed = "\n"; $csv->linefeed = "\n";