简体   繁体   中英

deleting file (.txt) using php

I have a problem deleting a file using php code/language. I tried unlink("file.txt"); but it doesn't work for me. I searched the Web but the same result it says unlink or delete("file.text");

Neither works for me.

I also tried this (I just got it from other sites/forum):

$f = fopen("file.txt","w");
fwrite($f, "");
fclose($f);
unlink("file.txt");

But it doesn't work either. Any other idea for this to work?

您必须使用服务器的路径来删除图像,如下所示。

unlink('/var/www/test/folder/file.txt'); // this is correct way

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM