当前位置: 首页>>代码示例>>PHP>>正文


PHP file::type方法代码示例

本文整理汇总了PHP中file::type方法的典型用法代码示例。如果您正苦于以下问题:PHP file::type方法的具体用法?PHP file::type怎么用?PHP file::type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在file的用法示例。


在下文中一共展示了file::type方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: upload

 public function upload()
 {
     //上传文件
     $this->files = $this->upload->save();
     //设置错误
     if ($this->upload->error()) {
         $this->error($this->upload->error(), $this->upload->msg());
     }
     if (is_array($this->files)) {
         //保存文件
         $ip = ip::current();
         $userid = $this->_user['id'];
         $description = (array) $this->description;
         foreach ($this->files as $key => $file) {
             $file['id'] = $file['id'];
             $file['parentid'] = $file['id'];
             $file['globalid'] = $this->globalid;
             $file['groupid'] = $this->folderid;
             $file['field'] = $this->field;
             $file['type'] = file::type($file['path']);
             $file['description'] = empty($description[$key]) ? $file['description'] : $description[$key];
             $file['userid'] = $userid;
             $file['status'] = (int) $this->status;
             $file['createip'] = $ip;
             $file['createtime'] = TIME;
             if ($file['type'] == 'image' || preg_match('/^(jpeg|jpeg|png|gif|bmp|ico|tif|tiff|psd|xbm|xcf)$/', $file['ext'])) {
                 $info = image::info($file['path']);
                 $file['width'] = (int) $info['width'];
                 $file['height'] = (int) $info['height'];
             }
             $this->insert($file);
         }
         return $this->files;
     }
     return array();
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:36,代码来源:file.php

示例2: die

    die("There sould be more than 1 file.");
}
foreach ($files as &$file) {
    $file = new file($file);
}
file::$type = "fileSize";
echo 'Zero sort' . "\n";
sort($files, SORT_STRING);
echo 'Zero deleteUnique' . "\n";
$files = deleteUnique($files);
file::$type = "shortHash";
echo 'First sort' . "\n";
sort($files, SORT_STRING);
echo 'First deleteUnique' . "\n";
$files = deleteUnique($files);
file::$type = "fullHash";
echo 'Second sort' . "\n";
sort($files, SORT_STRING);
echo 'Second deleteUnique' . "\n";
$files = deleteUnique($files);
echo 'Outputing' . "\n";
chdir($curDir);
// getFilesFromDir can change cDir. So rewind.
file_put_contents($output, "============================ Result ============================\r\n");
$lastIndex = count($files) - 1;
$filesBlock = array();
for ($i = 0; $i <= $lastIndex; $i++) {
    $filesBlock[] = $files[$i]->path;
    if ($i === $lastIndex || (string) $files[$i] != $files[$i + 1]) {
        $op = 'S';
        sort($filesBlock, SORT_STRING);
开发者ID:Quadramming,项目名称:PHP_TOOLS,代码行数:31,代码来源:QloneQillerV3.php


注:本文中的file::type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。