|
|
|
|
![]() ![]() |
May 2 2005, 11:24 PM
Post
#1
|
|
|
Newbie [ Level 2 ] Group: Banned Posts: 18 Joined: 2-May 05 Member No.: 4,656 |
this code to
Read from file you can use this code in to make a small data base and it is very to use CODE $fp = fopen ("file.txt", "r"); $bytes = 4; $buffer = fread($fp, $bytes); fclose ($fp); print $buffer; ------------------- to write to same file CODE $fp = fopen ("file.txt", "w+"); fwrite ($fp, "Test"); fclose ($fp); ---------------- thanks and iwait the commant This post has been edited by microscopic^earthling: May 3 2005, 06:31 AM |
|
|
|
May 3 2005, 12:13 PM
Post
#2
|
|
|
Pretty please? Group: Members Posts: 733 Joined: 28-November 04 From: Holland Member No.: 1,552 |
For reading a file, this is much easier
CODE $filedata = file_get_contents('filename.txt'); This function was implemented in PHP 4+ i think. |
|
|
|
May 14 2005, 08:17 PM
Post
#3
|
|
|
Newbie [ Level 2 ] Group: Members Posts: 12 Joined: 14-May 05 Member No.: 5,069 |
:0 thanks for thelp guys
|
|
|
|
May 15 2005, 02:01 AM
Post
#4
|
|
|
Newbie [ Level 1 ] Group: Banned Posts: 6 Joined: 15-May 05 Member No.: 5,083 |
QUOTE(jipman @ May 3 2005, 09:13 AM) For reading a file, this is much easier CODE $filedata = file_get_contents('filename.txt'); This function was implemented in PHP 4+ i think. Tip: You can use a URL as a filename with this function if the fopen wrappers have been enabled. <? $dp = "http://www.vaila.net/v1/home.php"; if (!$dp) { echo("<P>Error: unable to load URL file into $dp. Process aborted.</P>"); exit(); } $sp = file_get_contents($dp); highlight_string($sp); ?> |
|
|
|
May 21 2005, 03:20 AM
Post
#5
|
|
|
Newbie [ Level 2 ] Group: Members Posts: 28 Joined: 17-April 05 Member No.: 4,081 |
i implement this
QUOTE <? $fp = fopen('data.txt', 'r'); if ($fp) { while (!feof($fp)) { $texts = fread($fp, 4096); echo 'this is -> ' . $texts . '\n <br?'; } fclose($fp); } ?> for the data file: QUOTE data.txt satu@mon.com, combo@bakso.com, special@monyong.com, kuya.batok@forever.and.ever.com, special.pake.telor.2@tolong.jangan.lama.com the result : QUOTE this is -> satu@mon.com combo@bakso.com special@monyong.com kuya.batok@forever.and.ever.com special.pake.telor.2@tolong.jangan.lama.com \n what i want is can it read line by line ? no matter how long the line is danke |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 30th August 2008 - 03:25 PM |