How does PHP create a file directory? (Pure Code)

Source: Internet
Author: User
What this article brings to you is about how PHP creates file directories. (Pure code), there is a certain reference value, the need for friends can refer to, I hope to help you.

Create Directory/*   *  @param  CreateFile//Create folder   *  @param  createpath  //path created   *  @param  file_exists ()//See if the folder has the same directory   *  @param  File//created path is based on folder./public/uploads/  Create Modifications   *  @param  mkdir//Create folder function   *  @param 2017/11/20 8:57 */   function CreateFile ($file) {    $createpath = './public/uploads/'. $file;    $_createpath = Iconv (' utf-8 ', ' gb2312 ', $createpath);    if (file_exists ($_createpath) = = False)    {        //check if there is a folder, if not created, and give the highest permission if        (mkdir ($_createpath, 0700, true) {            $value [' file '] = ' folder creation succeeded ';            $value [' Success ']= ' success ';        } else {            $value [' file '] = ' folder creation failed ';            $value [' Fail ']= ' fail ';        }    }    else    {        $value [' file '] = ' folder already exists ';        $value [' Fail ']= ' fail ';    }    return $value;}

Related articles recommended:

How PHP is implemented to return JSON data (code)

How PHP can create a soft connection (code)

Related Article

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.