PHP递归地创建文件
<?php
if (!is_file(__DIR__.'/test/hello/world/test.txt')) {
if (!is_dir(__DIR__.'/test/hello/world')) {
$d = mkdir(__DIR__.'/test/hello/world', 0777, true); // 第三个参数即是否递归地创建目录
}
$handle = fopen(__DIR__.'/test/hello/world/test.txt','w');
fclose($handle);
}

浙公网安备 33010602011771号