How to generate a text file using php...?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
madhurima
Forum Newbie
Posts: 15
Joined: Thu Mar 12, 2009 4:55 am

How to generate a text file using php...?

Post by madhurima »

Hi,
Can anyone give me code to generate a text file using php


Thanks in advance,
madhu:)
User avatar
N1gel
Forum Commoner
Posts: 95
Joined: Sun Apr 30, 2006 12:01 pm

Re: How to generate a text file using php...?

Post by N1gel »

The PHP manual gives details on using the filesystem Filesystem

In the fwrite there is this example of writing a text file

Code: Select all

<?php
$fp = fopen('data.txt', 'w');
fwrite($fp, '1');
fwrite($fp, '23');
fclose($fp);
 
// the content of 'data.txt' is now 123 and not 23!
?>
madhurima
Forum Newbie
Posts: 15
Joined: Thu Mar 12, 2009 4:55 am

Re: How to generate a text file using php...?

Post by madhurima »

it's working..Thank u so much.. :D
Post Reply