GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Yet another PHP question.... (https://gfy.com/showthread.php?t=43769)

FADE19 12-09-2001 08:41 PM

Yet another PHP question....
 
Ok,
I have figured out how to
1)Write to a file
2)Read a file
3)Copy a file
4)Delete a file

but how the hell do you create a file??? programmatically?? I know I can go in there and add a file yes...but how do you create one via code? thanks in advance...

Ted 12-09-2001 08:45 PM

touch ("myfile.txt");

you can include a path with the file name if need be

FADE19 12-09-2001 08:48 PM

Thanks Ted, I have 5 different PHP books here and not one of them explains shit about how to create a file...time to update my book selection... http://bbs.gofuckyourself.net/board/biggrin.gif

Matt 12-09-2001 08:52 PM

http://www.php.net/manual/en/ref.filesystem.php

aleck 12-09-2001 08:53 PM

actually if u r opening a file for writing it can be created automatically (depending on the mode tho)

mode may be any of the following:


'r' - Open for reading only; place the file pointer at the beginning of the file.

'r+' - Open for reading and writing; place the file pointer at the beginning of the file.

'w' - Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.

'w+' - Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.

'a' - Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.

'a+' - Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it.



------------------
http://cyfrocash.com/adverts/button.gif
PlatinumBucks - amazing conversions, 65% recurring or $30+ per signup
BigPenis - $30 per signup from lifetime membership

amadman 12-09-2001 08:54 PM

I am not sure about php but some languages create a file when you open it for writing or apending and it does not already exist.

amadman 12-09-2001 08:56 PM

aleck
Beat me to the post :o)

FADE19 12-09-2001 08:57 PM

I know that when you are using FSO in ASP you actually have to create the file first...it is nice switch not have to do that http://bbs.gofuckyourself.net/board/smile.gif


All times are GMT -7. The time now is 10:14 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123