-
-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
31 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,17 +82,30 @@ use Bakame\Csv\Reader; | |
use Bakame\Csv\Writer; | ||
|
||
$reader = new Reader('/path/to/your/csv/file.csv'); | ||
$reader = new Reader(new SpliFileInfo('/path/to/your/csv/file.csv')); | ||
$reader = new Reader(new SpliFileInfo('/path/to/your/csv/file.csv'), 'rt'); | ||
$reader = Reader::createFromString('john,doe,[email protected]'); | ||
|
||
//or | ||
|
||
$writer = new Writer('/path/to/your/csv/file.csv', 'w'); | ||
$writer = new Writer(new SpliFileObject('/path/to/your/csv/file.csv'), 'a+'); | ||
$writer = new Writer('/path/to/your/csv/file.csv', 'ab+'); | ||
$writer = new Writer(new SpliFileObject('/path/to/your/csv/file.csv')); | ||
$writer = Writer::createFromString('john,doe,[email protected]'); | ||
``` | ||
|
||
Both classes constructors take one optional parameter `$open_mode` representing the file open mode used by the PHP [fopen](http://php.net/manual/en/function.fopen.php) function. | ||
Both classes constructors take one optional parameter `$open_mode` representing the file open mode used by the PHP [fopen](http://php.net/manual/en/function.fopen.php) function. | ||
|
||
The `$open_mode` parameter is taken into account if you instantiate your object with: | ||
|
||
* a `SplFileInfo` | ||
* a string path | ||
|
||
The `$open_mode` parameter is **ignore** if you instantiate your object with: | ||
|
||
* a `SplFileObject` | ||
* a `SplTempFileObject` | ||
|
||
When not explicitly set: | ||
|
||
* The `Bakame\Csv\Writer` `$open_mode` default value is `w`. | ||
* The `Bakame\Csv\Reader` `$open_mode` default value is `r`. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters