Automating redirect file creation

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
neridaj
Forum Commoner
Posts: 40
Joined: Fri Jan 05, 2007 9:55 pm

Automating redirect file creation

Post by neridaj »

Hello,

I have a script which uses mkdir() to generate user folders on registration, is there a similar function for file creation? I would like the script to create a redirect file for the folder generated by mkdir() upon user registration, any ideas?

Thanks,

Jason
User avatar
flying_circus
Forum Regular
Posts: 732
Joined: Wed Mar 05, 2008 10:23 pm
Location: Sunriver, OR

Re: Automating redirect file creation

Post by flying_circus »

Sure, use fopen() and fwrite().

fopen() creates the file and opens it as a resource

fwrite() will write a string (file contents) to a resource (the one created with fopen())

The example given for fwrite() is pretty straight forward and shows usage of fopen and fwrite

http://us2.php.net/manual/en/function.fwrite.php
Post Reply