SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru ujjwal's Avatar
    Join Date
    Oct 2004
    Location
    kolkata
    Posts
    821
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Newbie in file handling of php

    I am new in file handling of php.my code is working.It is not viewable when file mode is "r".but when modes are "w"or "a+" then it is fine means data are vanished in w mode and data is add when a+ mode.(if i use fwrite())
    but why it is not seen when mode is "r".plz help me and if u know any tutorial yhen told me.
    Advanced thanx.
    my code is:
    <?php

    $fp=fopen("./data.txt","r");
    //fwrite( $fp,'Hello World');
    if(!$fp) die ("Cannot open the file.");
    ?>
    save it try.php in inetpub/wwwroot and call it try.phpunder localhost in url.

  2. #2
    Non-Member St.'s Avatar
    Join Date
    Nov 2004
    Location
    Cloud #9
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what mod of ./data.txt ?

  3. #3
    SitePoint Guru ujjwal's Avatar
    Join Date
    Oct 2004
    Location
    kolkata
    Posts
    821
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by St.
    what mod of ./data.txt ?
    I have written a text file in a same folder wwwroot and saved it as data.txt..I want to see what is wriiten on that file using "r" mode in fopen function but i have failure to do this thing.What r u asking of mod of data.txt?

  4. #4
    Non-Member St.'s Avatar
    Join Date
    Nov 2004
    Location
    Cloud #9
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i mean access rules in system on file. who are owner of file? it is webserver user?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •