本文整理匯總了PHP中IO::CreateFolder方法的典型用法代碼示例。如果您正苦於以下問題:PHP IO::CreateFolder方法的具體用法?PHP IO::CreateFolder怎麽用?PHP IO::CreateFolder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IO
的用法示例。
在下文中一共展示了IO::CreateFolder方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
try {
$pcs = self::init($opath);
if (is_array($pcs) && $pcs['error']) {
return $pcs;
}
if ($arr['bz'] == $oarr['bz'] && !$iscopy) {
//同一api內
$data = self::getMeta($opath);
$response = $pcs->moveSingle($oarr['path'], $arr['path'] . '/' . $data['name']);
$result = json_decode($response, true);
if ($result['error_code']) {
$data['success'] = $result['error_msg'];
return $data;
}
$meta = $pcs->getMeta($arr['path'] . '/' . $data['name']);
$meta = json_decode($meta, true);
//if($meta['error_msg']) return array('error'=>$meta['error_msg']);
$meta = $meta['list'][0];
$data['newdata'] = self::_formatMeta($meta, $arr['bz']);
$data['success'] = true;
return $data;
} else {
$data = self::getMeta($opath);
switch ($data['type']) {
case 'folder':
//創建目錄
if ($re = IO::CreateFolder($path, $data['name'])) {
if (isset($re['error']) && intval($re['error_code']) != 31061) {
$data['success'] = $re['error'];
} else {
$data['newdata'] = $re['icoarr'];
$data['success'] = true;
$contents = self::listFiles($opath);
// print_r($contents);
foreach ($contents as $key => $value) {
$data['contents'][$key] = self::CopyTo($value['path'], $re['folderarr']['path']);
}
}
}
break;
default:
//$fileContent=IO::getFileContent($opath);
//exit($opath.'==='.$path.'==='.$data['name']);
if ($re = IO::multiUpload($opath, $path, $data['name'])) {
if ($re['error']) {
$data['success'] = $re['error'];
} else {
$data['newdata'] = $re;
$data['success'] = true;
}
}
}
}
} catch (Exception $e) {
//var_dump($e);
$data['success'] = $e->getMessage();
return $data;
}
return $data;
}
示例2: 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;
}
示例3: intval
//error_reporting(E_ALL);
if (!submitcheck('newfoldersubmit')) {
$path = $_GET['path'];
if (($fid = intval($path)) > 0 && ($folder = C::t('folder')->fetch_by_fid($fid)) && $folder['gid'] > 0 && (C::t('organization_admin')->ismoderator_by_uid_orgid($folder['gid'], $_G['uid']) || $_G['adminid'] == 1)) {
if (perm_binPerm::havePower('read2', $folder['perm1'])) {
$ismoderator = 1;
$permtitle = perm_binPerm::getGroupTitleByPower($folder['perm1']);
$permarr = perm_binPerm::groupPowerPack();
}
}
$foldername = IO::getFolderName(lang('template', 'newfolder', null, 'dzz'), $path);
} else {
$perm = intval($_GET['perm']);
$fname = io_dzz::name_filter(getstr($_GET['name'], 80));
$path = trim($_GET['path']);
if ($arr = IO::CreateFolder($path, $fname, $perm)) {
if ($arr['error']) {
showmessage($arr['error']);
} else {
$arr['msg'] = 'success';
showmessage('do_success', dreferer(), array('data' => rawurlencode(json_encode_gbk($arr))));
}
} else {
$arr = array();
$arr['msg'] = lang('template', 'failure_newfolder');
showmessage($arr['msg']);
}
}
} elseif ($do == 'share') {
$sharestatus = array('-4' => '已屏蔽', '-3' => '分享文件刪除', '-2' => '次數用盡', '-1' => '已過期', '0' => '正常');
if (!submitcheck('sharesubmit')) {
示例4: 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;
}
示例5: CopyTo
/**
* 移動文件到目標位置
* @param string $opath 被移動的文件路徑
* @param string $path 目標位置(可能是同一api內或跨api,這兩種情況分開處理)
* @return icosdatas
*/
public function CopyTo($icoid, $path, $iscopy)
{
try {
$data = self::getMeta($icoid);
if (is_numeric($path)) {
//如果目標位置也是本地
if (!$iscopy) {
$re = self::FileMove($icoid, $path, true);
$data['newdata'] = $re['icoarr'];
$data['success'] = true;
} else {
$re = self::FileCopy($icoid, $path, true);
$data['newdata'] = $re['icoarr'];
$data['success'] = true;
}
if ($re['error']) {
$data['success'] = $re['error'];
}
} else {
switch ($data['type']) {
case 'folder':
//創建目錄
if ($re = IO::CreateFolder($path, $data['name'])) {
if (isset($re['error']) && intval($re['error_code']) != 31061) {
$data['success'] = $arr['error'];
} else {
$data['newdata'] = $re['icoarr'];
$data['success'] = true;
$contents = C::t('icos')->fetch_all_by_pfid($data['oid']);
foreach ($contents as $key => $value) {
$data['contents'][$key] = self::CopyTo($value['icoid'], $re['folderarr']['path']);
}
}
}
break;
case 'shortcut':
case 'discuss':
case 'dzzdoc':
case 'user':
case 'link':
case 'music':
case 'video':
case 'topic':
case 'app':
//這些內容不能移動到api網盤內;
$data['success'] = lang('message', '非文件類隻能存儲在企業盤');
break;
default:
$re = IO::multiUpload($icoid, $path, $data['name']);
if ($re['error']) {
$data['success'] = $re['error'];
} else {
$data['newdata'] = $re;
$data['success'] = true;
}
break;
}
}
} catch (Exception $e) {
$data['success'] = $e->getMessage();
}
$data['iscopy'] = $iscopy;
return $data;
}
示例6: 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);
$client = self::init($opath);
$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']) && intval($re['error_code']) != 31061) {
$data['success'] = $arr['error'];
} else {
$data['newdata'] = $re['icoarr'];
$data['success'] = true;
//echo $opath.'<br>';
$contents = self::listFilesAll($client, $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']);
$err = Qiniu_RS_Move($client, $arr['bucket'], $arr['object'], $oarr['bucket'], $oarr['object']);
if ($err !== null) {
$data['success'] = $err->Code . ':' . $err->Err;
} else {
$data['newdata'] = self::getMeta($path . $data['name']);
$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;
}
return $data;
}