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);
}

  

猜你喜欢

转载自www.cnblogs.com/chenmenghui/p/9070941.html
今日推荐