SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Location
    aaaa
    Posts
    84
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    printing a trunk information to a file

    This is the code printing a line of information to a text file
    Code:
    $name ="my name";
    $fh = fopen( $log, "w");
    fputs( $fh, $name ."\n" );
    fclose( $fh );
    How about if the information consist a trunk of information like
    Code:
    <html>
    <head>
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta http-equiv="Content-Type" content="text/html; charset=">
    <title>ooopppp1</title>
    </head>
    <body>
    </body>
    </html>
    Should I put it in line by line or some other ways ??

  2. #2
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What is a "trunk"?
    John

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Location
    aaaa
    Posts
    84
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    trunk means a lot of lines
    I have heard there is a way of using here document to do the job instead you put it back line like
    Code:
    fputs( $fh, "<html>\n" );
    fputs( $fh, "<head>\n" );
    fputs( $fh, "<meta name="GENERATOR" content="Microsoft FrontPage 5.0"> \n" );
    fputs( $fh, "<meta name="ProgId" content="FrontPage.Editor.Document"> \n" );
    .....
    .... 


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
  •