Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
fwrite i slijedeći red

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side
View previous topic :: View next topic  
Author Message
snyder



Joined: 21 Dec 2005
Posts: 57
Location: Zagreb

PostPosted: 05.06.2006 18:18    Post subject: fwrite i slijedeći red Add user to your forum ignore list Reply with quote

dakle imam
Code:

$file = 'proba.txt';
$rad = fopen($file, 'a');
for ($i = 0; $i < 5; $i++) {
   fwrite($rad, 'Neki tekst koji nakon kojeg ide slijedeći red\n');
}
fclose($rad);

htio bi 5 puta upisati tu rečenicu i da je svaka u svojem redu u txt fileu
zar ne bi \n trebao prebaciti u slijedeci red?
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
nel`chee



Joined: 08 Jul 2004
Posts: 2087
Location: Rijeka

PostPosted: 05.06.2006 19:03    Post subject: Add user to your forum ignore list Reply with quote

prvo, navodnici trebaju biti dvostruki da \n prihvati kao linebreak.
drugo, fali ti parametar na kraju fwrite funkcije - moras funkciji reci koliko upisuje.
Code:
$file = 'proba.txt';
$rad = fopen($file, 'a');
for ($i = 0; $i < 5; $i++) {
   $tekst = "Neki tekst koji nakon kojeg ide slijedeći red\n";
   fwrite($rad, $tekst, strlen($tekst));
}
fclose($rad);
Back to top
View user's profile Send private message Visit poster's website Twitter profile
snyder



Joined: 21 Dec 2005
Posts: 57
Location: Zagreb

PostPosted: 05.06.2006 20:00    Post subject: Add user to your forum ignore list Reply with quote

super, thx.
štos je u tome da sam navikao sve raditi sa ' ne "
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Sulien



Joined: 04 Jan 2004
Posts: 2905
Location: Zagreb

PostPosted: 05.06.2006 22:06    Post subject: Add user to your forum ignore list Reply with quote

Uvijek možeš i
Code:
// recimo da imaš array nečega
$my_stuff = array('lorem', 'ipsum', 'dolor');

file_put_contents('proba.txt', implode("\n", $my_stuff));


...ovisno o prilici, naravno
Back to top
View user's profile Send private message Send e-mail Visit poster's website
gog



Joined: 18 Jun 2004
Posts: 679
Location: zagreb

PostPosted: 05.06.2006 23:10    Post subject: Add user to your forum ignore list Reply with quote

Umijesto "\n" stavi "\r\n" ako hoćeš da i na windowsima bude new line...
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group