You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<?php
namespace backend\logic\file;
use common\models\ars\TemFile;
class FileManager { public static $extension = [ TemFile::TYPE_IMAGE => ['jpg', 'png', 'jpeg'], TemFile::TYPE_VIDEO => ['mp4'], TemFile::TYPE_EXCEL => [], TemFile::TYPE_WORD => ['docx'], TemFile::TYPE_TXT => ['txt'], ];
/** * @param $array * @param $value * @param int $key * @return int * 查看$extension数组中是否存在文件类型,不存在则返回-1 */ public function searchKey($array,$value, $key=-1){ foreach($array as $k=>$row){ if(!is_array($row)){ if($row == $value){ if($key != -1) { return $key; }else{ return -1; } } }else{ $r = self::searchKey($row,$value, $k); if($r != -1){ return $r; } } } return -1; } }
|