mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 00:36:38 +00:00
README.md: Fix incorrect constructor usage
This commit is contained in:
13
README.md
13
README.md
@@ -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";
|
||||||
|
|||||||
Reference in New Issue
Block a user