[PHP] Cara Membaca Isi File & Menulis ke File

Discussion in 'Programming' started by apartemen, Sep 30, 2014.

  1. apartemen

    apartemen New Member

    Joined:
    Sep 25, 2014
    Messages:
    12
    Likes Received:
    2
    Trophy Points:
    3
    Buat yang penasaran cara membaca isi sebuah file dengan PHP / cara menuliskan ke sebuah file dengan PHP, bisa coba kode di bawah.

    Cara membaca isi file :
    PHP:
    <?php
    $isi_file 
    file_get_contents('readme.txt');
    echo 
    $isi_file;
    ?>
    Cara menulis ke dalam file :
    PHP:
    <?php
    $tulis 
    'Ini isi pesan yang akan ditulis';
    file_put_contents('readme.txt'$tulis);
    ?>
     
    kaliwungu likes this.
  2. Ardilas

    Ardilas Super Level

    Joined:
    Feb 18, 2013
    Messages:
    4,243
    Likes Received:
    317
    Trophy Points:
    83
    Google+:
  3. Yusuf.S

    Yusuf.S Well-Known Member

    Joined:
    May 4, 2014
    Messages:
    1,155
    Likes Received:
    100
    Trophy Points:
    63
    Google+:
    Saya ga ngerti, *boohoo*
     
  4. Richad

    Richad New Member

    Joined:
    Aug 12, 2014
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Itu kode kode buat program pascal ya?
     
  5. apartemen

    apartemen New Member

    Joined:
    Sep 25, 2014
    Messages:
    12
    Likes Received:
    2
    Trophy Points:
    3
    Bukan, ini PHP kok :)
     
  6. Taufiq Rahman

    Taufiq Rahman Member

    Joined:
    Sep 29, 2014
    Messages:
    147
    Likes Received:
    8
    Trophy Points:
    18
    nah ini dia yang saya cari-cari... Akhirnya ada juga :D
    Makasih ya Gan TS Udah sharing :D


    Sangat bermanfaat gan.... *bagus*
     
  7. siska sari

    siska sari Member

    Joined:
    Jun 18, 2014
    Messages:
    22
    Likes Received:
    1
    Trophy Points:
    8
    bingung , implementasinya gmna gan ?
     
  8. Devita

    Devita Active Member

    Joined:
    Oct 11, 2014
    Messages:
    1,196
    Likes Received:
    43
    Trophy Points:
    48
    Google+:
    Ada gak visual php yang mudah, semacam visual pemrograman dekstop.?
     
  9. tonbad

    tonbad Member

    Joined:
    Dec 21, 2014
    Messages:
    260
    Likes Received:
    24
    Trophy Points:
    18
    Google+:
    ini mantapnya jika digunakan untuk media save log hasil running program..
     
  10. oboth

    oboth New Member

    Joined:
    Feb 8, 2015
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    6
    Bagusnya digunakan buat apa ? bisa buat configurasi aplikasi ga ? Kalo nulis / membuat file txt gimana
     
  11. Doni Bianconeri

    Doni Bianconeri New Member

    Joined:
    May 19, 2014
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Saya sangat buta sekali dengan code PHP, jangan nulis, bacanya aja gak paham..lebih mudah memahami html, css, atau javascript..

    sebenarnya pengen belajar, karena saya berniat pengin punya domain sendiri di wordpress yang tentunya penuh dengan code PHP nantinya...
     
  12. Faisal Reza

    Faisal Reza Member

    Joined:
    Feb 27, 2017
    Messages:
    36
    Likes Received:
    7
    Trophy Points:
    8
    ajibb tutornya kebetulan baru belajar PHP juga nih gan :D
     
Loading...

Share This Page