unlink delete php filesystem function example - delete a file from given source
unlink-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>unlink delete 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="unlink delete php filesystem function example - delete a file from given source">
<meta name="keywords" content="php, example, code, array, function, delete, string, uplink">
<meta name="description" content="unlink delete php filesystem function example - delete a file from given source">
<style>
h2, h4{background:orange; color:#000083;}
h2{ padding:3px; margin:3px; font-size:22px;}
h4{ padding:2px; margin:2px; font-size:19px;}
p{padding:2px; margin:2px; color:#0099FD;}
body{ background:#FFFFFC;}
</style>
</head>
<body>
<h2>unlink delete php filesystem function example - delete a file from given source</h2>
<pre>
<?php
/*
-------------------------------------------------------
let say we have a file test.php in the same directory
where the current script file is located
and we would like to unlink or delete the file
-------------------------------------------------------
*/
$unlinkFile = "test.php";
echo "<h4>File to be unlinked or deleted</h4>";
print "<p>$"."unlinkFile = {$unlinkFile}</p>";
$IsFileUnlinked = unlink($unlinkFile);
if($IsFileUnlinked)
{
print "<h4>file unlink or delete success</h4>";
}
else
{
print "<h4>file unlink or delete failed</h4>";
}
/*
------------------------------------------------------
you can add source of the file along with $unlinkFile
------------------------------------------------------
*/
/*
---------------------------------------------------------------------------------------
this function rapidly used in professional programming to unlink or delete a file
---------------------------------------------------------------------------------------
*/
?>
</pre>
</body>
</html>

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