删除文件,支持多个文件,多服务器可以自动同步
boolean Core_File::unlink( string/array $file [, string $storage = string(7) "default" ] )
参数列表
参数 类型 描述 默认值 $file
string/array
$file $storage
string
物理存储组,不传则为默认 string(7) "default"
boolean
public static function unlink($file, $storage='default')
{
$info = File::check_and_get_path($file);
if (File::can_do_run($storage))
{
try
{
if (is_array($file))
{
$rs = true;
foreach ($file as $f)
{
if (is_file($f))
{
if (!unlink($f))
{
$rs = false;
break;
}
}
}
return $rs;
}
else
{
if (is_file($file))
{
return unlink($file);
}
elseif (is_dir($file))
{
return false;
}
else
{
return true;
}
}
}
catch (Exception $e)
{
return false;
}
}
else
{
return File::call_http_host($storage, 'file/unlink', $info[0], $info[1]);
}
}