rabin 1 vuosi sitten
vanhempi
commit
d77cefe508
1 muutettua tiedostoa jossa 23 lisäystä ja 0 poistoa
  1. 23 0
      lib/View.php

+ 23 - 0
lib/View.php

@@ -0,0 +1,23 @@
+<?php namespace Upload\Lib;
+use Dever;
+class View
+{
+    private $config = array
+    (
+        1 => 'Local',
+        2 => 'Qiniu',
+        3 => 'Oss',
+    );
+
+    public function local($file)
+    {
+        $host = Dever::host() . 'data/';
+        if (strstr($file, $host)) {
+            return str_replace($host, Dever::data(), $file);
+        } else {
+            $local = Dever::file('tmp/' . md5($file));
+            file_put_contents($local, file_get_contents($file), LOCK_EX);
+            return $local;
+        }
+    }
+}