PHP Unlink Not working

前端 未结 7 1565
小鲜肉
小鲜肉 2021-01-11 15:34

I am trying to delete photo in php using unlink. I have used it earlier on other server but this time it is not working. I have used absolute path for a test but still does

7条回答
  •  日久生厌
    2021-01-11 16:11

    Give relative path from the folder where images are kept to the file where you are writing script. If file structure is like:

    -your php file
    -images
      -1.jpg
    
    then 
    
    unlink(images/1.jpg);
    

    Or there may be some folder permission issue. Your files are on a server or you are running it on localhost? If it is on a server then give 755 permission to the images folder.

提交回复
热议问题