[摘要]]/", "", explode(DIRECTORY_SEPARATOR, ext)); array_pop(ext); ...
]/", "", explode(DIRECTORY_SEPARATOR, $ext));
array_pop($ext);
$path = explode(DIRECTORY_SEPARATOR, $path); // 建立目录层轴
if ($path[count($path)-1]=="") array_pop($path);
while (count($ext)) {
$i = array_shift($ext);
if ($i==".."&&count($path)>1) array_pop($path);
elseif (""!=str_replace(".", "", $i)) $path[] = $i;
}
$path = implode(DIRECTORY_SEPARATOR, $path);
}
unset($ext, $i);
return $path;
}
/**
* @]Method Name[= make_dir()
* @]Purpose[=
* 建立任意文件夹,相对或绝对路径皆可,深层建立亦可
* @]Parameter[=
* string $path 要建立的最终目录路径
* @]Return[= boolean 错误返回 FALSE,否则 TRUE
* @]Author[= SNakeVil <51JS,BU,PHPx> (snakevil@qq.com)
* @]See[=
*/
function make_dir($path="") {
$i = explode(DIRECTORY_SEPARATOR, $this->generate_path($path)); // 生成目录路径
$path = array_shift($i);
for ($j=0,$k=count($i);$j<$k;$j++) {
$path .= DIRECTORY_SEPARATOR.$i[$j];
if (!is_dir($path)) {
if ($this->exist_dir=="") $this->exist_dir = $path; // 记录最后存在的目录路径
if (!@mkdir($path)) return $this->error_occur(0x0003, substr($path, 0, strrpos($path, DIRECTORY_SEPARATOR)));
}
}
if ($this->exist_dir=="") $this->exist_dir = $path;
return TRUE;
}
/**
* @]Method Name[= verify_file()
* @]Purpose[=
* 使用 MD5 算法比较两个文件是否相同
* @]Parameter[=
* string $src 源文件路径
* string $dst 目标文件路径
* boolean $interal 对于超过 1MB 文件,设置 FALSE 省去 MD5 检验步骤,减轻服务器负担
* @]Return[= boolean 错误返回 FALSE,否则 TRUE
* @]Author[= SNakeVil <51JS,BU,PHPx> (snakevil@qq.com)
* @]See[=
*/
function verify_file($src="", $dst="", $interal=TRUE) {
if (!is_file($src)
关键词:PHP文件系统基本设置类