mirror of https://gitee.com/topnuomi/zxf
23 lines
485 B
PHP
23 lines
485 B
PHP
|
<?php
|
||
|
|
||
|
$file = './style.less.bak';
|
||
|
$newfile = './style.less';
|
||
|
|
||
|
$fp = fopen($file, 'a+');
|
||
|
$newfp = fopen($newfile, 'a+');
|
||
|
|
||
|
while (!feof($fp)) {
|
||
|
$line = fgets($fp);
|
||
|
$t = preg_replace_callback("/ (\d+)px/", function ($item) {
|
||
|
return ' ' . ($item[1] * 1) / 100 . 'rem';
|
||
|
}, $line);
|
||
|
|
||
|
fwrite($newfp, $t);
|
||
|
// print_r($t);
|
||
|
// preg_match_all("/ (\d+)px/", $line, $temp_matches, PREG_OFFSET_CAPTURE);
|
||
|
// print_r($temp_matches);
|
||
|
}
|
||
|
|
||
|
fclose($fp);
|
||
|
fclose($newfp);
|