正在显示
2 个修改的文件
包含
20 行增加
和
21 行删除
@@ -53,32 +53,12 @@ class Qiniu | @@ -53,32 +53,12 @@ class Qiniu | ||
53 | $previewUrl = $fileType == 'image' ? $this->getPreviewUrl($file, $watermark) : $this->getFileDownloadUrl($file); | 53 | $previewUrl = $fileType == 'image' ? $this->getPreviewUrl($file, $watermark) : $this->getFileDownloadUrl($file); |
54 | $url = $fileType == 'image' ? $this->getImageUrl($file, $watermark) : $this->getFileDownloadUrl($file); | 54 | $url = $fileType == 'image' ? $this->getImageUrl($file, $watermark) : $this->getFileDownloadUrl($file); |
55 | 55 | ||
56 | - $sys = $this->getOperateSys(); | ||
57 | - | ||
58 | - if($sys == 'Linux'){ | ||
59 | - $file = ROOT_PATH.'/public/upload/'.$file; | ||
60 | - unlink($file);//适用于linux | ||
61 | - } | ||
62 | return [ | 56 | return [ |
63 | 'preview_url' => $previewUrl, | 57 | 'preview_url' => $previewUrl, |
64 | 'url' => $url, | 58 | 'url' => $url, |
65 | ]; | 59 | ]; |
66 | } | 60 | } |
67 | 61 | ||
68 | - //判断当前操作系统 | ||
69 | - public function getOperateSys(){ | ||
70 | - $os_name = php_uname('s'); | ||
71 | - //判断 | ||
72 | - if(strpos($os_name,"Linux")!==false){ | ||
73 | - $os_str="Linux"; | ||
74 | - }else if(strpos($os_name,"Windows")!==false){ | ||
75 | - $os_str="Windows"; | ||
76 | - }else{ | ||
77 | - $os_str=''; | ||
78 | - } | ||
79 | - return $os_str; | ||
80 | - } | ||
81 | - | ||
82 | /** | 62 | /** |
83 | * 获取图片预览地址 | 63 | * 获取图片预览地址 |
84 | * @param string $file | 64 | * @param string $file |
@@ -327,7 +327,12 @@ class Upload | @@ -327,7 +327,12 @@ class Upload | ||
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 | //我加的 | 329 | //我加的 |
330 | - unlink('./upload/' . $arrInfo["file_path"]); | 330 | + |
331 | + $sys = $this->getOperateSys(); | ||
332 | + if($sys == 'Linux'){ | ||
333 | + $file = ROOT_PATH.'/public/upload/' . $arrInfo["file_path"]; | ||
334 | + unlink($file);//适用于linux | ||
335 | + } | ||
331 | return array_merge([ | 336 | return array_merge([ |
332 | 'filepath' => $arrInfo["file_path"], | 337 | 'filepath' => $arrInfo["file_path"], |
333 | "name" => $arrInfo["filename"], | 338 | "name" => $arrInfo["filename"], |
@@ -361,4 +366,18 @@ class Upload | @@ -361,4 +366,18 @@ class Upload | ||
361 | ]; | 366 | ]; |
362 | } | 367 | } |
363 | 368 | ||
369 | + //判断当前操作系统 | ||
370 | + private function getOperateSys(){ | ||
371 | + $os_name = php_uname('s'); | ||
372 | + //判断 | ||
373 | + if(strpos($os_name,"Linux")!==false){ | ||
374 | + $os_str="Linux"; | ||
375 | + }else if(strpos($os_name,"Windows")!==false){ | ||
376 | + $os_str="Windows"; | ||
377 | + }else{ | ||
378 | + $os_str=''; | ||
379 | + } | ||
380 | + return $os_str; | ||
381 | + } | ||
382 | + | ||
364 | } | 383 | } |
-
请 注册 或 登录 后发表评论