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
    • 121
    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

     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:

    <?php
    //here define a dir file
    $dir_file = "file.txt";
    //here call unlink() and check 
    if (!unlink($dir_file))
      {
      echo ("Fail ! Error deleting $dir_file");
      }
    else
      {
      echo ("Success ! Deleted $dir_file");
      }
    
    ?>
    

    The output of the code above will be:

    Fail ! Error deleting $dir_file
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: