Question

Whenever I try to delete the counter.txt using PHP, I always get an error:

Fatal error: Call to undefined function delete() in C:\XAMPP\htdocs\jellykat\control-panel.php on line 12

Here is my code:

<?php delete("counter.txt"); ?>

What's wrong with it? Can you suggest me ways on the other methods that I can delete the counter.txt?

Don't blame me. I got the delete() method from here: http://www.w3schools.com/php/func_filesystem_delete.asp

Was it helpful?

Solution

You should use unlink() instead .. there is no such delete()

If you see the manual of delete() , It says..

This is a dummy manual entry to satisfy those people who are looking for unlink() or unset() in the wrong place.

So, it should be

<?php unlink("counter.txt"); ?>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top