PHP file directory operation development process and sample sharing

Source: Internet
Author: User
We often encounter the creation of files directory, file (folder) editing operations, today to introduce you a PHP file directory operation class, you can set up directories, delete directories, create files, delete files, move folders, copy folders and other functions you can operate.

First download the php file directory operation class library that we need to use in this lesson: http://www.php.cn/xiazai/leiku/544

After the download, find the PHP class files we need, unzip to our local directory, create a new PHP file!

Once this is done, we will invoke this class in the new PHP file, and instantiate the class:

<?phpinclude_once "caozuo1.php";                Introduce class file $obj = new Fileutil;                       Instantiate class $obj->createdir (' A/1/2/3 ');                Test build folder to build a A/1/2/3 folder $obj->createfile (' B/1/2/3 ');               The test build file        is built under the b/1/2/folder with a 3 file $obj->createfile (' B/1/2/3.exe ');           Test the build file        under the b/1/2/folder to build a 3.exe file $obj->copydir (' B ', ' d/e ');                  Test the Copy folder to create a d/e folder, copy the contents of the B folder into the $obj->copyfile (' B/1/2/3.exe ', ' b/b/3.exe '); Test the copy file to        create a b/b folder and copy the 3.exe file in the B/1/2 folder into $obj->movedir (' A ', ' b/c ');                 Test the Mobile folder to create a b/c folder, and move the contents of the A folder into, and delete the A folder $obj->movefile (' B/1/2/3.exe ', ' b/d/3.exe '); Test the move file to        create a b/d folder and move the 3.exe in the B/1/2 to $obj->unlinkfile (' B/d/3.exe ');             Test Delete file        Delete b/d/3.exe file $obj->unlinkdir (' d ');                      Test Delete folder Delete D folder?>

Note: This run results page will be blank:

But in our local I can find that the file directory has been created, such as:


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.