Thinkphp File Processing class Dir. class. php application-PHP development

Source: Internet
Author: User
Tags delete cache
In my WBlog, a cache cleanup worker can delete cache files generated when the program is running. All these files are stored in the Runtime folder of the project. At that time, when I used a function customized by the project function library to delete the cached files, I could only delete the entire Runtime, which was too rough. I think it is necessary to perform a further deletion. In fact, the thinkphp extension class library has a good file processing class Dir. class. php. Dir. class. not every thinkp of the php class can be cleared in my WBlog. Clearing the cache is to delete the cache files generated when the program is running, all these files are stored in the Runtime folder of the project. At that time, when I used a function customized by the project function library to delete the cached files, I could only delete the entire Runtime, which was too rough. I think it is necessary to perform a further deletion. In fact, the thinkphp extension class library has a good file processing class Dir. class. php. The Dir. class. php class is not available in every thinkphp version. if the version you downloaded does not exist, you can find it from other versions. Now let's talk about the application of Dir. class. php.


Dir. class. php is a file processing class. You can use it:
1. Get the file information under the Directory
2. delete a directory or file


As I want to improve the WBlog cache clearing function, I only write the above 2nd functions. As for the 1st functions, I will write the template text modification function again. The following is a del () method defined by the Controller that is clearing the cache:

Public function del () {$ type = trim ($

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.