delete unlink php filesystem function example - delete a file from given source
delete-php-filesystem-function-example.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>delete unlink php filesystem function example - delete a file from given source</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Md Iqbal Hosan">
<meta name="title" content="delete unlink php filesystem function example - delete a file from given source">
<meta name="keywords" content="php, example, code, array, function, delete, string">
<meta name="description" content="delete unlink php filesystem function example - delete a file from given source">
<style>
h2, h4{background:yellow; color:#000085;}
h2{ padding:3px; margin:3px; font-size:20px;}
h4{ padding:2px; margin:2px; font-size:18px;}
p{padding:2px; margin:2px; color:#0099FC;}
body{ background:#FFFFFE;}
</style>
</head>
<body>
<h2>delete unlink php filesystem function example - delete a file from given source</h2>
<pre>
<?php
/*
-------------------------------------------------------
let say we have a file test2.php in the same directory
where the current script file is located
and we would like to delete the file
-------------------------------------------------------
*/
$deleteFile = "test2.php";
echo "<h4>File to be deleted</h4>";
print "<p>$"."deleteFile = {$deleteFile}</p>";
$IsFileDelete = unlink($deleteFile);
if($IsFileDelete)
{
print "<h4>file delete success</h4>";
}
else
{
print "<h4>file delete failed</h4>";
}
/*
------------------------------------------------------
you can add source of the file along with $deleteFile
------------------------------------------------------
*/
/*
---------------------------------------------------------------------------------------
this function rapidly used in professional programming to delete a file
---------------------------------------------------------------------------------------
*/
?>
</pre>
</body>
</html>

No comments:
Post a Comment
leave your comments here..