检查并且获取系统允许读写路径信息,如果不合法则返回false
array($key,$path) Core_File::check_and_get_path( string/array $file )
参数列表
参数 类型 描述 默认值 $file
string/array
$file
array($key,$path)
protected static function check_and_get_path($file)
{
if (is_array($file))
{
$array_mode = true;
}
else
{
$array_mode = false;
$file = (array)$file;
}
$data = array();
foreach (File::$dir as $key=>$path)
{
$len = strlen($path);
foreach ($file as $f)
{
$s = substr($f,0,$len);
if ($s == $path)
{
if (!$array_mode)
{
# 单文件模式,直接返回
return array($key,substr($f,$len));
}
else
{
# 多文件,加入列表
$data[0][] = $key;
$data[1][] = substr($f,$len);
}
}
}
}
if ($array_mode && $data)return $data;
throw new Exception(__('Not allowed to operate the corresponding directory'));
}