One line of code to delete all files in the directory
· Memo notes · 0 comment · 1,535 Views

One line of code to delete all files in the directory

· Memo notes · 0 comment · 1,535 Views

 glob

Presumably many people will write a few or even dozens of lines of code to list all the files into an array to delete, but glob function minutes to solve the problem!

 array_ map('unlink', glob('*'));
Comments are closed.