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)