本文整理匯總了PHP中IO::parsePath方法的典型用法代碼示例。如果您正苦於以下問題:PHP IO::parsePath方法的具體用法?PHP IO::parsePath怎麽用?PHP IO::parsePath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IO
的用法示例。
在下文中一共展示了IO::parsePath方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: CopyTo
/**
* 移動文件到目標位置
* @param string $opath 被移動的文件路徑
* @param string $path 目標位置(可能是同一api內或跨api,這兩種情況分開處理)
* @return icosdatas
*/
public function CopyTo($opath, $path, $iscopy)
{
$oarr = self::parsePath($opath);
$arr = IO::parsePath($path);
$data = self::getMeta($opath);
switch ($data['type']) {
case 'folder':
//創建目錄
if ($re = IO::CreateFolder($path, $data['name'])) {
$data['newdata'] = $re['icoarr'];
$data['success'] = true;
$contents = self::listFiles($opath);
foreach ($contents as $key => $value) {
$data['contents'][$key] = self::CopyTo($value['path'], $re['folderarr']['path']);
}
}
break;
default:
if ($re = IO::multiUpload($opath, $path, $data['name'])) {
if ($re['error']) {
$data['success'] = $re['error'];
} else {
$data['newdata'] = $re;
$data['success'] = true;
}
}
}
return $data;
}
示例2: getFolderInfo
public function getFolderInfo($path, $position = '', $zip)
{
static $data = array();
try {
$arr = IO::parsePath($path);
$pcs = self::init($path, 1);
if (is_array($pcs) && $pcs['error']) {
return $pcs;
}
$meta = self::getMeta($path);
switch ($meta['type']) {
case 'folder':
$position .= $meta['name'] . '/';
$contents = self::listFiles($path);
foreach ($contents as $key => $value) {
self::getFolderInfo($value['path'], $position, $zip);
}
break;
default:
$meta['url'] = self::getStream($meta['path']);
$meta['position'] = $position . $meta['name'];
//$data[$meta['icoid']]=$meta;
$zip->addLargeFile(fopen($meta['url'], 'rb'), $meta['position'], $meta['dateline']);
}
} catch (Exception $e) {
//var_dump($e);
$data['error'] = $e->getMessage();
return $data;
}
//return $data;
}
示例3: CopyTo
/**
* 移動文件到目標位置
* @param string $opath 被移動的文件路徑
* @param string $path 目標位置(可能是同一api內或跨api,這兩種情況分開處理)
* @return icosdatas
*/
public function CopyTo($opath, $path, $iscopy)
{
static $i = 0;
$i++;
$oarr = self::parsePath($opath);
$arr = IO::parsePath($path);
$jss = self::init($opath);
if (is_array($jss) && $jss['error']) {
return $jss;
}
try {
$data = self::getMeta($opath);
switch ($data['type']) {
case 'folder':
//創建目錄
//exit($arr['path'].'===='.$data['name']);
if ($re = IO::CreateFolder($path, $data['name'])) {
if (isset($re['error'])) {
$data['success'] = $arr['error'];
} else {
$data['newdata'] = $re['icoarr'];
$data['success'] = true;
//echo $opath.'<br>';
$contents = self::listFilesAll($jss, $opath);
$value = array();
foreach ($contents as $key => $value) {
if ($value['path'] != $opath) {
$data['contents'][$key] = self::CopyTo($value['path'], $re['folderarr']['path']);
}
$value = array();
}
}
} else {
$data['success'] = 'create folder failure';
}
break;
default:
/*if($arr['bz']==$oarr['bz']){//同一個api時
$arr=self::parsePath($path.$data['name']);
$response=$jss->copy_object($oarr['bucket'],$oarr['object'],$arr['bucket'],$arr['object']);
if(!$response->is_ok()){
$data['success']=$response->status;
}
$meta=array(
'Key'=>$arr['object'],
'Size'=>$data['size'],
'LastModified'=>$response->header['date'],
);
$data['newdata']=self::_formatMeta($meta,$arr);
$data['success']=true;
}else{*/
if ($re = IO::multiUpload($opath, $path, $data['name'])) {
if ($re['error']) {
$data['success'] = $re['error'];
} else {
$data['newdata'] = $re;
$data['success'] = true;
}
}
//}
break;
}
// }
} catch (Exception $e) {
//var_dump($e);
$data['success'] = $e->getMessage();
return $data;
}
return $data;
}