當前位置: 首頁>>代碼示例>>PHP>>正文


PHP IO::getMeta方法代碼示例

本文整理匯總了PHP中IO::getMeta方法的典型用法代碼示例。如果您正苦於以下問題:PHP IO::getMeta方法的具體用法?PHP IO::getMeta怎麽用?PHP IO::getMeta使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在IO的用法示例。


在下文中一共展示了IO::getMeta方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getDataByPath

 public function getDataByPath($path)
 {
     $data = array();
     $patharr = explode(':', $path);
     $bzarr = C::t('connect')->fetch_all_bz();
     if (in_array($patharr[0], $bzarr)) {
         $bz = $patharr[0];
     } else {
         $bz = 'dzz';
     }
     if ($bz == 'dzz') {
         list($idtype, $id) = explode('_', str_replace('dzz:', '', $path));
         if ($idtype == 'fid') {
             $data = C::t('folder')->fetch_by_fid($id);
             $data['name'] = $data['title'];
             $data['oid'] = $data['fid'];
             $data['bz'] = '';
             $data['path'] = $data['fid'];
             $data['topfid'] = array();
             $data['type'] = 'folder';
             $data['folderarr'] = IO::getFolderDatasByPath($id);
             foreach ($data['folderarr'] as $value) {
                 $data['topfid'][] = $value['fid'];
             }
         } elseif ($idtype == 'icoid') {
             $data = C::t('icos')->fetch_by_icoid($id);
             if ($data['type'] == 'folder') {
                 $data['topfid'] = array();
                 $data['folderarr'] = IO::getFolderDatasByPath($data['oid']);
                 foreach ($data['folderarr'] as $value) {
                     $data['topfid'][] = $value['fid'];
                 }
             }
         }
     } else {
         $data = IO::getMeta($path);
         if ($data['type'] == 'folder') {
             $data['topfid'] = array();
             $data['folderarr'] = IO::getFolderDatasByPath($data['path']);
             foreach ($data['folderarr'] as $value) {
                 if (!empty($value['fid'])) {
                     $data['topfid'][] = $value['fid'];
                 }
             }
             $data['topfid'] = array_reverse($data['topfid']);
         }
     }
     return $data;
 }
開發者ID:druphliu,項目名稱:dzzoffice,代碼行數:49,代碼來源:table_source_shortcut.php

示例2: multiUpload

 public function multiUpload($opath, $path, $filename, $attach = array(), $ondup = "newcopy")
 {
     global $_G;
     /* 
      * 分塊上傳文件
      * param $file:文件路徑(可以是url路徑,需要服務器開啟allow_url_fopen);
      */
     $partsize = 1024 * 1024 * 5;
     //分塊大小2M
     if ($attach) {
         $data = $attach;
         $data['size'] = $attach['filesize'];
     } else {
         $data = IO::getMeta($opath);
         if ($data['error']) {
             return $data;
         }
     }
     $size = $data['size'];
     if (is_array($filepath = IO::getStream($opath))) {
         return array('error' => $filepath['error']);
     }
     if ($size < $partsize) {
         //獲取文件內容
         if (!($handle = fopen($filepath, 'rb'))) {
             return array('error' => '打開文件錯誤');
         }
         while (!feof($handle)) {
             $fileContent .= fread($handle, 8192);
             //if(strlen($fileContent)==0) return array('error'=>'文件不存在');
         }
         return self::upload($fileContent, $path, $filename, false, $ondup);
     } else {
         //分片上傳
         self::deleteCache($path . $filename);
         if (!($handle = fopen($filepath, 'rb'))) {
             return array('error' => '打開文件錯誤');
         }
         $fileContent = '';
         while (!feof($handle)) {
             $fileContent .= fread($handle, 8192);
             //if(strlen($fileContent)==0) return array('error'=>'文件不存在');
             if (strlen($fileContent) >= $partsize) {
                 $re = self::upload($fileContent, $path, $filename, true, $ondup);
                 if ($re['error']) {
                     return $re;
                 }
                 $fileContent = '';
             }
         }
         fclose($handle);
         if (!empty($fileContent)) {
             $re = self::upload($fileContent, $path, $filename, true, $ondup);
             if ($re['error']) {
                 return $re;
             }
         }
         //分片上傳結束,合並分片文件
         return self::createSuperFile($path, $filename, $ondup);
     }
 }
開發者ID:druphliu,項目名稱:dzzoffice,代碼行數:61,代碼來源:io_baiduPCS.php

示例3: Encode_Core

    require_once DZZ_ROOT . './dzz/class/class_encode.php';
    $p = new Encode_Core();
    $code = $p->get_encoding($str);
    if ($code) {
        $str = diconv($str, $code, CHARSET);
    }
    $str = htmlspecialchars($str);
    include template('textviewer');
} else {
    if (!($path = dzzdecode($_GET['path']))) {
        showmessage('參數錯誤!');
    }
    $dpath = dzzencode($path);
    $error = '';
    $table = '';
    $icoarr = IO::getMeta($path);
    $maxputsize = 0;
    //get_config_bytes(ini_get('post_max_size'));
    if (!$maxputsize) {
        $maxputsize = 2000000;
    }
    if ($icoarr['size'] > $maxputsize) {
        $url = DZZSCRIPT . '?mod=textviewer&path=' . dzzencode($path);
        header("Location: {$url}");
        exit;
    }
    if (isset($icoarr['error'])) {
        exit($icoarr['error']);
    }
    //根據ext獲取加載codemirror的mode;
    $ext = isset($icoarr['ext']) ? $icoarr['ext'] : '';
開發者ID:druphliu,項目名稱:dzzoffice,代碼行數:31,代碼來源:textviewer.php

示例4: libfile

 * @author      zyx(zyx@dzz.cc)
 */
@set_time_limit(0);
include_once libfile('class/ZipStream');
$patharr = $_GET['paths'];
print_r($_GET);
exit('dfdsfsf');
$meta = IO::getMeta(dzzdecode($patharr[0]));
if ($meta['error']) {
    exit($meta['error']);
}
$filename = strtolower(CHARSET) == 'utf-8' && (strexists($_SERVER['HTTP_USER_AGENT'], 'MSIE') || strexists($_SERVER['HTTP_USER_AGENT'], 'rv:11')) ? urlencode($meta['name']) : $meta['name'];
$zip = new ZipStream($filename . ".zip");
foreach ($patharr as $dpath) {
    $path = dzzdecode($dpath);
    $meta = IO::getMeta($path);
    switch ($meta['type']) {
        case 'app':
        case 'video':
        case 'dzzdoc':
        case 'link':
            continue;
            break;
        case 'folder':
            IO::getFolderInfo($path, $meta['name'], $zip);
            break;
        default:
            $zip->addLargeFile(fopen(IO::getStream($path), 'rb'), $meta['name'], $meta['dateline']);
            break;
    }
}
開發者ID:druphliu,項目名稱:dzzoffice,代碼行數:31,代碼來源:download.php

示例5: multiUpload

 public function multiUpload($opath, $path, $filename, $attach = array(), $ondup = "newcopy")
 {
     global $_G;
     /* 
      * 分塊上傳文件
      * param $file:文件路徑(可以是url路徑,需要服務器開啟allow_url_fopen);
      */
     @set_time_limit(0);
     $partsize = 1024 * 1024 * 2;
     //分塊大小2M
     if ($attach) {
         $data = $attach;
         $data['size'] = $attach['filesize'];
     } else {
         $data = IO::getMeta($opath);
         if ($data['error']) {
             return $data;
         }
     }
     if ($data['error']) {
         return $data;
     }
     $size = $data['size'];
     if (is_array($filepath = IO::getStream($opath))) {
         return array('error' => $filepath['error']);
     }
     //exit(($size<$partsize).'===='.$size.'==='.$filepath.'===='.$path);
     if ($size < $partsize) {
         //獲取文件內容
         $fileContent = '';
         if (!($handle = fopen($filepath, 'rb'))) {
             return array('error' => '文件打開錯誤');
         }
         while (!feof($handle)) {
             $fileContent .= fread($handle, 8192);
             //if(strlen($fileContent)==0) return array('error'=>'文件不存在');
         }
         fclose($handle);
         //exit('upload');
         return self::upload_by_content($fileContent, $path, $filename);
     } else {
         //分片上傳
         $partinfo = array('ispart' => true, 'partnum' => 0, 'iscomplete' => false);
         if (!($handle = fopen($filepath, 'rb'))) {
             return array('error' => '文件打開錯誤');
         }
         //stream_set_timeout($handle,5);
         $ext = strtolower(substr(strrchr($filename, '.'), 1));
         $cachefile = $_G['setting']['attachdir'] . './cache/' . md5($opath) . '.' . $ext;
         while (!feof($handle)) {
             $fileContent .= fread($handle, 8192);
             //if(strlen($fileContent)==0) return array('error'=>'文件不存在');
             if (strlen($fileContent) > $partsize) {
                 $partinfo['partnum'] += 1;
                 if ($partinfo['partnum'] * $partsize >= $size) {
                     $partinfo['iscomplete'] = true;
                 }
                 file_put_contents($cachefile, $fileContent);
                 $re = self::upload($cachefile, $path, $filename, $partinfo);
                 if ($re['error']) {
                     return $re;
                 }
                 if ($partinfo['iscomplete']) {
                     @unlink($cachefile);
                     return $re;
                 }
                 $fileContent = '';
             }
         }
         fclose($handle);
         if (!empty($fileContent)) {
             $partinfo['partnum'] += 1;
             $partinfo['iscomplete'] = true;
             file_put_contents($cachefile, $fileContent);
             $re = self::upload($cachefile, $path, $filename, $partinfo);
             if ($re['error']) {
                 return $re;
             }
             if ($partinfo['iscomplete']) {
                 @unlink($cachefile);
                 return $re;
             }
         }
     }
 }
開發者ID:druphliu,項目名稱:dzzoffice,代碼行數:85,代碼來源:io_JSS.php

示例6: multiUpload

 public function multiUpload($opath, $path, $filename, $attach = array(), $ondup = "newcopy")
 {
     /* 
      * 分塊上傳文件
      * param $file:文件路徑(可以是url路徑,需要服務器開啟allow_url_fopen);
      */
     $partsize = 1024 * 1024 * 5;
     //分塊大小2M
     $data = IO::getMeta($opath);
     if ($data['error']) {
         return $data;
     }
     $size = $data['size'];
     if (is_array($filepath = IO::getStream($opath))) {
         return array('error' => $filepath['error']);
     }
     if ($size < $partsize) {
         //獲取文件內容
         $fileContent = '';
         if (!($handle = fopen($filepath, 'rb'))) {
             return array('error' => '打開文件錯誤');
         }
         while (!feof($handle)) {
             $fileContent .= fread($handle, 8192);
         }
         fclose($handle);
         return self::upload($fileContent, $path, $filename);
     } else {
         //分片上傳
         $partinfo = array('ispart' => true, 'partnum' => 0, 'flag' => $path, 'iscomplete' => false);
         if (!($handle = fopen($filepath, 'rb'))) {
             return array('error' => '打開文件錯誤');
         }
         $fileContent = '';
         while (!feof($handle)) {
             $fileContent .= fread($handle, 8192);
             if (strlen($fileContent) >= $partsize) {
                 $partinfo['partnum'] += 1;
                 if ($partinfo['partnum'] * $partsize >= $size) {
                     $partinfo['iscomplete'] = true;
                 }
                 if ($re = self::upload($fileContent, $path, $filename, $partinfo)) {
                     if ($re['error']) {
                         return $re;
                     }
                     if ($partinfo['iscomplete']) {
                         return $re;
                     }
                 }
                 $fileContent = '';
             }
         }
         fclose($handle);
         if (!empty($fileContent)) {
             $partinfo['partnum'] += 1;
             $partinfo['iscomplete'] = true;
             if ($re = self::upload($fileContent, $path, $filename, $partinfo)) {
                 if ($re['error']) {
                     return $re;
                 }
                 if ($partinfo['iscomplete']) {
                     return $re;
                 }
             }
         }
     }
 }
開發者ID:druphliu,項目名稱:dzzoffice,代碼行數:67,代碼來源:io_dzz.php

示例7: multiUpload

 public function multiUpload($opath, $path, $filename, $attach = array(), $ondup = "newcopy")
 {
     global $_G;
     @set_time_limit(0);
     /* 
      * 分塊上傳文件
      * param $file:文件路徑(可以是url路徑,需要服務器開啟allow_url_fopen);
      */
     $partsize = 1024 * 1024 * 4;
     //分塊大小2M
     if ($attach) {
         $data = $attach;
         $data['size'] = $attach['filesize'];
     } else {
         $data = IO::getMeta($opath);
         if ($data['error']) {
             return $data;
         }
     }
     $size = $data['size'];
     if (is_array($filepath = IO::getStream($opath))) {
         return array('error' => $filepath['error']);
     }
     if ($size < $partsize) {
         //獲取文件內容
         $fileContent = '';
         if (!($handle = fopen($filepath, 'rb'))) {
             return array('error' => '打開文件錯誤');
         }
         while (!feof($handle)) {
             $fileContent .= fread($handle, 8192);
             //if(strlen($fileContent)==0) return array('error'=>'文件不存在');
         }
         fclose($handle);
         return self::upload_by_content($fileContent, $path, $filename);
     } else {
         //分片上傳
         if (!($handle = fopen($filepath, 'rb'))) {
             return array('error' => '打開文件錯誤');
         }
         $partinfo = array('ispart' => true);
         $cachefile = $_G['setting']['attachdir'] . './cache/' . md5($opath);
         while (!feof($handle)) {
             file_put_contents($cachefile, fread($handle, 8192), FILE_APPEND);
         }
         $re = self::upload($cachefile, $path, $filename);
         @unlink($cachefile);
         return $re;
     }
 }
開發者ID:druphliu,項目名稱:dzzoffice,代碼行數:50,代碼來源:io_qiniu.php


注:本文中的IO::getMeta方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。