最新消息: 新版网站上线了!!!

php css在线合并源码

$css = array(
    'main.css',
    'menu.css',
    'content.css'
);
 
// Prevent a notice
$css_content = '';
 
// Loop the css Array
foreach ($css as $css_file) {
    if(file_exists($css_file)){
    // Load the content of the css file 
    $css_content .= file_get_contents($css_file);
    $css_content = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $css_content);
            /* remove tabs, spaces, newlines, etc. */
    $css_content = str_replace(array("\r\n", "\r", "\n", "\t", '  ', '    ', '    '), '', $css_content);
}
}
 
// print the css content
echo $css_content;

转载请注明:谷谷点程序 » php css在线合并源码