rabin 6 天之前
父节点
当前提交
e61e59fb1b
共有 1 个文件被更改,包括 13 次插入3 次删除
  1. 13 3
      lib/View.php

+ 13 - 3
lib/View.php

@@ -25,16 +25,26 @@ class View
         return $host . $info['file'];
         return $host . $info['file'];
     }
     }
 
 
-    public function local($file)
+    public function local($file, $convert = false)
     {
     {
+        if (strstr($file, '?')) {
+            $temp = explode('?', $file);
+            $file = $temp[0];
+        }
+        $base = Dever::data();
         $host = Dever::host() . 'data/';
         $host = Dever::host() . 'data/';
         if (strstr($file, $host)) {
         if (strstr($file, $host)) {
-            return str_replace($host, Dever::data(), $file);
+            $local = str_replace($host, $base, $file);
         } else {
         } else {
             $local = Dever::file('tmp/' . md5($file));
             $local = Dever::file('tmp/' . md5($file));
             file_put_contents($local, file_get_contents($file), LOCK_EX);
             file_put_contents($local, file_get_contents($file), LOCK_EX);
-            return $local;
         }
         }
+        if ($convert) {
+            if (strstr($base, '/www/') && !strstr($base, 'wwwroot')) {
+                $local = str_replace('/www/', '/data/dm/container/web/', $local);
+            }
+        }
+        return $local;
     }
     }
 
 
     public function http($file)
     public function http($file)