Created
April 23, 2016 16:16
-
-
Save valdiney/d88b0b27c7b167764ae94f69deca3cc7 to your computer and use it in GitHub Desktop.
Exporting data to the txt file
This file contains hidden or 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
<?php | |
/* | |
* @license http://opensource.org/licenses/gpl-license.php GNU Public License | |
* @author Valdiney França <[email protected]> | |
* @version 0.1 | |
* With this class you can pass data into the text file of simple way. | |
*/ | |
class ExportToTxt | |
{ | |
protected $path; | |
protected $file; | |
# Receive the path of the archive text | |
public function set_path($path) | |
{ | |
$this->path = $path; | |
} | |
# Receive the file, do not need pass the extension of the file | |
public function set_file($file) | |
{ | |
$help = "{$this->path}/{$file}.txt"; | |
$this->file = fopen($help, 'w'); | |
} | |
# This method is used to write the data in the archive text | |
public function write_in_file($archives) | |
{ | |
fwrite($this->file, $archives); | |
} | |
# You shold use this method to close de connection with the archive | |
public function close() | |
{ | |
fclose($this->file); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment