当前位置:网站首页>PHP uses recursive and non recursive methods to create multi-level folders
PHP uses recursive and non recursive methods to create multi-level folders
2022-06-24 09:56:00 【BigChen_ up】
Project requirements : Recursive creation is required AA/BB/CC/DD Folder ; The code implementation is as follows :
function makeDir($dir) {
// First determine whether the parent directory exists , If it doesn't exist , Create an upper level directory
$prev = dirname($dir);
if (!file_exists($prev)) {
// Create an upper level directory
makeDir($prev);
}
// The upper level directory was created successfully , Create the current directory
mkdir($dir);
}
makeDir('AA/BB/CC/DD');
Methods that do not use recursion can use PHP Self contained function : mkdir(‘dir1/dir2/dir3’, 0777, true);
Note that this notation only supports PHP5.5 Above version
边栏推荐
猜你喜欢

NVIDIA's CVPR 2022 oral is on fire! 2D images become realistic 3D objects in seconds! Here comes the virtual jazz band!

微信小程序學習之 實現列錶渲染和條件渲染.

Binary tree part I

Five heart matchmaker

物联网?快来看 Arduino 上云啦

编程题(持续更新)

记录一下MySql update会锁定哪些范围的数据

Talking about the knowledge of digital transformation

使用Live Chat促进业务销售的惊人技巧

ByteDance Interviewer: talk about the principle of audio and video synchronization. Can audio and video be absolutely synchronized?
随机推荐
新手怎么选择投资理财产品的等级?
JS proxy mode
算法---矩阵中战斗力最弱的 K 行(Kotlin)
Algorithm -- find and maximum length k subsequence (kotlin)
Practical analysis: implementation principle of APP scanning code landing (app+ detailed logic on the web side) with source code
Observer mode
Canvas draw picture
Prct-1400: failed to execute getcrshome resolution
LeetCode: 377. Combined sum IV
队列Queue
数字化转型的失败原因及成功之道
PTA猴子选大王(约瑟夫环问题)
2021-08-17
Latex formula and table recognition
二叉樹第一部分
Oracle数据文件头SCN不一致处理方法
Jcim | AI based protein structure prediction in drug discovery: impacts and challenges
In depth study paper reading target detection (VII) Chinese English Bilingual Edition: yolov4 optimal speed and accuracy of object detection
Use of vim
IDEA 无法保存设置 源根 D:XXXX在模块XXX中重复