PHP with .TXT

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • The Numerator

    PHP with .TXT

    I am in the process of a new project. I will have the main text with
    HTML saved into a .TXT file. I want the PHP file to fetch the .TXT
    file, which would be in the directory songs/. As a beginner, this may
    seem very easy... Well, if you do know, please reply... Thank you.

  • Geoff Berrow

    #2
    Re: PHP with .TXT

    Message-ID: <1148924391.881 732.130100@j73g 2000cwa.googleg roups.com> from
    The Numerator contained the following:
    [color=blue]
    >I am in the process of a new project. I will have the main text with
    >HTML saved into a .TXT file. I want the PHP file to fetch the .TXT
    >file, which would be in the directory songs/. As a beginner, this may
    >seem very easy... Well, if you do know, please reply... Thank you.[/color]

    <?php
    include('file.t xt');
    ?>

    --
    Geoff Berrow 011000100110110 0010000000110
    001101101011011 001000110111101 100111001011
    100110001101101 111001011100111 010101101011

    Comment

    • pakalk@gmail.com

      #3
      Re: PHP with .TXT

      include 'songs/file.txt'; // for example, if you just wanna paste it
      into your page

      or if you want to put file contents into array:

      $array = file('songs/file.txt'); // every line in seperate array
      elements

      or if you want to put file contents into string:

      $string = file_get_conten ts('songs/file.txt');

      In future, use PHP-manual. It is really good source of PHP-knowledge
      (even substitutes tutorials).

      Comment

      Working...