SHARE
TWEET

Untitled

a guest Jun 20th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private function fputcsv_custom1($fp, $array, $eol)
  2. {
  3.   fputcsv($fp, $array, ';');
  4.   if ("rn" != $eol && fseek($fp, -1, SEEK_CUR) === 0)
  5.   { fwrite($fp, $eol . "rn"); }
  6. }
  7.      
  8. $peoples = OnlineSz::all()->toArray();
  9.  
  10. $file = fopen("online_hotel.csv", "w+");
  11. $file1 = fopen("online_hotel.txt", "w+");
  12.  
  13. array_keys($peoples);
  14.  
  15. foreach ($peoples as $key => $array) {
  16.   $this->fputcsv_custom($file, $array, ';');
  17.   $this->fputcsv_custom1($file1, $array, ';');
  18. }
  19. fclose($file);
  20. fclose($file1);
  21.      
  22. 53;"New test";Worker;test;test;4000;test;test;06123456789;test;0;0;CC;;0;0;
  23.      
  24. $this->fputcsv_custom($file4, str_ireplace(chr(32), '/',$user), ';');
  25. $this->fputcsv_custom1($file5, str_ireplace(chr(32), '/',$user), ';');
  26.      
  27. 53;New/test;Alkalmazott;test;test;4000;test;test;06123456789;0;0;CC;0;0;
  28.      
  29. $var  = str_ireplace('"', '', $var); //strip quotes from $var
  30.  
  31.  
  32.  
  33.  $this->fputcsv_custom($file, str_ireplace('"', '',$array), ';');
  34.  $this->fputcsv_custom1($file1, str_ireplace('"', '',$array), ';');
  35.      
  36. $this->fputcsv_custom($file, trim(str_ireplace('"', '',$array)), ';');
  37.  $this->fputcsv_custom1($file1, trim(str_ireplace('"', '',$array)), ';');
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top