ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
CSVWriter.php
Go to the documentation of this file.
1 <?php
2 
3 namespace SimpleExcel\Writer;
4 
11 class CSVWriter extends BaseWriter implements IWriter
12 {
19  protected $content_type = 'text/csv';
20 
27  protected $delimiter = ',';
28 
35  protected $file_extension = 'csv';
36 
42  public function saveString(){
43  $fp = fopen('php://temp', 'r+');
44  foreach ($this->tabl_data as $row) {
45  fputcsv($fp, $row, $this->delimiter);
46  }
47  rewind($fp);
48  $content = stream_get_contents($fp);
49  fclose($fp);
50  return $content;
51  }
52 
59  public function setDelimiter($delimiter){
60  $this->delimiter = $delimiter;
61  }
62 }
63 ?>