私は今のようにcssファイルのURLを変更str_replace('url(', 'url(somelocation/', $content);
していましたが、url(/のような絶対パスのものを除外したいのですが、誰かが何かを提案していますか?
2 に答える
1
preg_replace('@url\(([^/].*)\)$@', preg_quote($location) . '$1', $content);
于 2010-11-08T22:51:00.340 に答える
0
$location = 'somelocation'; // or however you're getting somelocation
if (strpos($location, '/') === 0) {
$location = substr($location, 1);
}
str_replace('url(', 'url(' . $location, $content);
于 2010-11-08T22:22:25.527 に答える