Home  >  Article  >  Backend Development  >  PHP directory php php directory operation php mkdir multi-level directory

PHP directory php php directory operation php mkdir multi-level directory

WBOY
WBOYOriginal
2016-07-29 08:55:141229browse

Directory operation

  • Create new directory
    mkdir (path, permissions, recursive creation)
  • Delete directory
    rmdir()
  • Move (rename)
    rename()
  • Get directory content
    //Open directory
    Directory handle = opendir()
    //Read directory
    File name = readdir(directory handle)
    Read the file names in sequence and move the file handle pointer downward at the same time. If it cannot be read, it returns false
    //Close directory
    closedir()

Recursively read directory contents


showDir('../../file');
functionshowDir($path,$dep=0){$pos = opendir($path);
    while(false!==$file=readdir($pos)){
        if($file=='.'||$file=='..') continue;
        echo str_repeat(" ",$dep*4),$file.'
'
; if(is_dir($path.'/'.$file)){ $func = __FUNCTION__; $func($path.'/'.$file,$dep+1); } } }

php目录遍历,php 根目录,php 当前目录,php目录是否存在,php 目录结构,php 安装目录,php,php 目录操作,php mkdir 多级目

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above has introduced the PHP directory, including PHP and directory content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn