|
@ -15,7 +15,7 @@ class FileManager |
|
|
const TYPE_WORD = 4;//word文本
|
|
|
const TYPE_WORD = 4;//word文本
|
|
|
const TYPE_TXT = 5;//txt文本
|
|
|
const TYPE_TXT = 5;//txt文本
|
|
|
|
|
|
|
|
|
public static $extension = [ |
|
|
|
|
|
|
|
|
private $extension = [ |
|
|
self::TYPE_IMAGE => ['jpg', 'png', 'jpeg'], |
|
|
self::TYPE_IMAGE => ['jpg', 'png', 'jpeg'], |
|
|
self::TYPE_VIDEO => ['mp4'], |
|
|
self::TYPE_VIDEO => ['mp4'], |
|
|
self::TYPE_EXCEL => [], |
|
|
self::TYPE_EXCEL => [], |
|
@ -29,16 +29,14 @@ class FileManager |
|
|
* @return array |
|
|
* @return array |
|
|
* 根据文件拓展名在$extension中查找对应的文件类型,若不存在则返回false |
|
|
* 根据文件拓展名在$extension中查找对应的文件类型,若不存在则返回false |
|
|
*/ |
|
|
*/ |
|
|
public function searchType($array, $keyword) |
|
|
|
|
|
|
|
|
public function searchType($keyword) |
|
|
{ |
|
|
{ |
|
|
foreach($array as $key => $value){ |
|
|
|
|
|
foreach ($value as $k => $v) { |
|
|
|
|
|
if($v == $keyword){ |
|
|
|
|
|
return ['status' => true, 'info' => '操作成功', 'type' => $key]; |
|
|
|
|
|
|
|
|
foreach($this->extension as $key => $type){ |
|
|
|
|
|
if (in_array($keyword, $type)) { |
|
|
|
|
|
return $key; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
return ['status' => false, 'info' => '操作失败']; |
|
|
|
|
|
|
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|