Today, We want to share with you unlink in php.In this post we will show you php delete file in directory, hear for similar to UNIX unlink() Function we will give you demo and example for implement.In this post, we will learn about php delete file Functions with an example.
PHP | unlink() Function
There are the Following The simple About delete uploaded file php Full Information With Example and source code.
As I will cover this Post with live Working example to develop php delete file, so The unlink() function is an inbuilt function in PHP is used for this example is following below.
Syntax:
unlink( $filename, $context )
delete a file named tamilrokers.txt using unlike() function
<?php $find_file_folder = "tamilrokers.txt"; // Use unlink() function to delete a file if (!unlink($find_file_folder)) { echo ("$find_file_folder cannot be deleted due to an error"); } else { echo ("$find_file_folder has been deleted"); } ?>
delete a file named tamilrokers.txt using unlike() function
<?php $find_file_folder = fopen('tamilrokers.txt', 'w+'); // writing on a file named tamilrokers.txt fwrite($find_file_folder, 'A computer science portal for geeks!'); fclose($find_file_folder); // Use php unlink() function to delete a file if (!unlink($find_file_folder)) { echo ("$find_file_folder cannot be deleted due to an error"); } else { echo ("$find_file_folder has been deleted"); } ?>
Summary
You can also read about AngularJS, ASP.NET, VueJs, PHP.
I hope you get an idea about unlink in php.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, donβt forget to share.