正在显示
1 个修改的文件
包含
20 行增加
和
0 行删除
@@ -326,6 +326,13 @@ class Upload | @@ -326,6 +326,13 @@ class Upload | ||
326 | session_write_close(); | 326 | session_write_close(); |
327 | $result = $storage->upload($arrInfo["file_path"], './upload/' . $arrInfo["file_path"], $fileType); | 327 | $result = $storage->upload($arrInfo["file_path"], './upload/' . $arrInfo["file_path"], $fileType); |
328 | if (!empty($result)) { | 328 | if (!empty($result)) { |
329 | + //我加的 | ||
330 | + $sys = $this->getOperateSys(); | ||
331 | + if($sys == 'Linux'){ | ||
332 | + $file = ROOT_PATH.'/public/upload/' . $arrInfo["file_path"]; | ||
333 | + unlink($file);//适用于linux | ||
334 | + } | ||
335 | + | ||
329 | return array_merge([ | 336 | return array_merge([ |
330 | 'filepath' => $arrInfo["file_path"], | 337 | 'filepath' => $arrInfo["file_path"], |
331 | "name" => $arrInfo["filename"], | 338 | "name" => $arrInfo["filename"], |
@@ -358,5 +365,18 @@ class Upload | @@ -358,5 +365,18 @@ class Upload | ||
358 | 'url' => cmf_get_root() . '/upload/' . $arrInfo["file_path"], | 365 | 'url' => cmf_get_root() . '/upload/' . $arrInfo["file_path"], |
359 | ]; | 366 | ]; |
360 | } | 367 | } |
368 | + //判断当前操作系统 | ||
369 | + private function getOperateSys(){ | ||
370 | + $os_name = php_uname('s'); | ||
371 | + //判断 | ||
372 | + if(strpos($os_name,"Linux")!==false){ | ||
373 | + $os_str="Linux"; | ||
374 | + }else if(strpos($os_name,"Windows")!==false){ | ||
375 | + $os_str="Windows"; | ||
376 | + }else{ | ||
377 | + $os_str=''; | ||
378 | + } | ||
379 | + return $os_str; | ||
380 | + } | ||
361 | 381 | ||
362 | } | 382 | } |
-
请 注册 或 登录 后发表评论