Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • What is process to unlink a directory in PHP ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 123
    Comment on it

    Hi Reader's,
    Welcome to FindNerd, today we are going to discuss how to unlink a directory by using PHP ?

    The unlink() function is used to deleted a file.unlink() function returns TRUE on success and FALSE on failure.

    syntax of unlink() function

    1. unlink(filename,context)

    There are two main parameter in above example:
    1-filename:-This is required parameter
    2-context:- This is optional parameter

    you can see below example:

    1. <?php
    2. //here define a dir file
    3. $dir_file = "file.txt";
    4. //here call unlink() and check
    5. if (!unlink($dir_file))
    6. {
    7. echo ("Fail ! Error deleting $dir_file");
    8. }
    9. else
    10. {
    11. echo ("Success ! Deleted $dir_file");
    12. }
    13.  
    14. ?>

    The output of the code above will be:

    1. Fail ! Error deleting $dir_file

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: