0) { foreach ($match[1] as $_m) { $m = trim($_m, "'\" \r\n"); if ($m[0] != '/') { $m = '/' . $m; } $_fd = $dest . $m; $_fs = $remote . $m; if (!is_dir(dirname($_fd))) { mkdir(dirname($_fd), 0777, true); } if (is_file($_fd)) { echo "file exists.[$_fd]\n"; continue; } str_replace($m, $csspath . $m, $content); if (copy($_fs, $_fd)) { echo "download remote file[$_fs] to [$_fd].\n"; //var_dump($m, $csspath.$m); } else { echo "download fail.file[$_fs] to [$_fd].\n"; } } } file_put_contents($f, $content); echo "parse ok. [$f]\n"; }