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

  

posted @ 2018-05-22 14:50  不觉风止  阅读(132)  评论(0编辑  收藏  举报