Home > php教程 > php手册 > PHP 循环检查创建目录 ,0777

PHP 循环检查创建目录 ,0777

WBOY
Release: 2016-06-06 19:49:39
Original
827 people have browsed it

function ckDir($path){ $path = is_dir($path) ? $path:dirname($path); $folderArr = explode(/,$path); $dir = $comma = ; foreach($folderArr as $folder){ $dir .= $comma.$folder; $comma = /; if($dir == . || $dir == ..) continue; if(!is_dir($dir


2011-08-20 更正:上面这个写的太复杂了,下面这个精简版的:

function MkFolder($path){
  if(!is_readable($path)){
    MkFolder( dirname($path) );
    if(!is_file($path)) mkdir($path,0777);
    }
}
Copy after login



source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template