SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to generate .php files?

    Is their a way with php to create a .php file into a giver directory? I know I can use mkdir to make a new folder on my server, but lets say I want to make a php file and put it in a given folder. How do I do this?

  2. #2
    Non-Member St.'s Avatar
    Join Date
    Nov 2004
    Location
    Cloud #9
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Like each other file.

    $f = fopen( "yourfile.php", "w" );
    fwrite( $f, $cool_script );
    fclose( $f );

    but I think this is not good idea. |-Q

  3. #3
    Free Geek computerages's Avatar
    Join Date
    Oct 2004
    Location
    /dev/null
    Posts
    1,071
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by St.
    but I think this is not good idea. |-Q
    Why? Is there any special reason?

  4. #4
    Put your best practices away. The New Guy's Avatar
    Join Date
    Sep 2002
    Location
    Canada
    Posts
    2,087
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Why would you need it?
    "A nerd who gets contacts
    and a trendy hair cut is still a nerd"

    - Stephen Colbert on Apple Users

  5. #5
    Non-Member St.'s Avatar
    Join Date
    Nov 2004
    Location
    Cloud #9
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    2 computerages:

    Yes. It is executable file open to write.
    It's not bad in itself, but if man dont know how write a file, he can make many holes.

  6. #6
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks everyone for the quick reply’s.
    I appear to be getting an error. “Parse error: parse error, unexpected T_VARIABLE in”
    I set the variable to “test” to test this but I seem to be getting an error.


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
  •