web 2.0

How to use PHP & Fopen() Create New File

How to use PHP & Fopen() Create New File Learn how to use the PHP to Create New File on web server.

ShotDev Focus:
- PHP & Create New File

Example

php_create_file.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?
$strFileName = "shotdev/my.txt";
$objCreate = fopen($strFileName, 'w');
if($objCreate)
{
echo "File created.";
}
else
{
echo "Cannot create file.";
}
fclose($objCreate);
?>

</body>
</html>

Create a php file and save to path root-path/myphp/

Run
http://localhost/myphp/php_create_file.php

Screenshot

PHP Create New File

PHP Create New File
.
.
.

Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 1.00 out of 10)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.