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