Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Odwieczny problem łamania linii (fwrite) w pliku txt
Victor152
post
Post #1





Grupa: Zarejestrowani
Postów: 105
Pomógł: 3
Dołączył: 26.02.2008

Ostrzeżenie: (0%)
-----


Witajcie. Podczas zapisywania pliku txt za pomocą funkcji fopen, fwrite, fclose nie mogę wrzucić do niego łamania linii. Próbowałem przez \r\n, \n oraz \n\r i nic.

Efekt:
Cytat
==== 22:01 ==== .... ====\r\n== mc_gross => 2.00\r\n== protection_eligibility => Eligible\r\n== address_status => confirmed\r\n== payer_id => PQTXAWLAHL86A\r\n== tax => 0.00\r\n==== VERIFIED ====\r\n\r\n


Sam skrypt php jest następujący:
  1. <?php
  2. $this->fhandle = fopen($path.$date.'.log', 'a+');
  3.        flock($this->fhandle, LOCK_EX);
  4.        
  5.        //HOW IT WILL LOOKS
  6.        $log = '==== '.$time.' ==== '.$this->array['payer_email'].' ====\n';
  7.        
  8.        foreach ($this->array as $key => $value)
  9.        {
  10.            $log .= '== '.$key.' => '.$value.'\n';
  11.        }
  12.        
  13.        $log .= '==== '.trim($this->output).' ====\n\n';
  14.        
  15.        fwrite($this->fhandle, str_replace('\n', 'r\n', $log));
  16.        flock($fp, LOCK_UN);
  17.        fclose($this->fhandle);
  18. ?>


I co ja mam począć? (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif)
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 25.12.2025 - 07:39