|
-
Sep 9th, 2012, 06:03 AM
#1
Thread Starter
Addicted Member
File write, read, open
I am learning today how to open file, write it or read by using PHP. I made some code which is probably wrong since everything I learnd is mixed in my head.
PHP Code:
<?php
$name = "text.txt";
$write = fopen($name, 'w') or die("Can't open file");
$open = fopen($name, 'r');
$data = "AAAAAAAAAAAAAAA";
$show = fwrite($write,$data);
$a = fgets($open);
fclose($open);
echo $open;
?>
There is the problem. I want to create a new file called text.txt . Then I want to write something in ti and finaly after reading in to display that file on the screen. How to do that?
-
Sep 10th, 2012, 02:17 AM
#2
Re: File write, read, open
Try:
not
Also try using file_put_contents and file_get_contents instead.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|