這裏是一個例子。可以保存輸出緩衝區嗎?我想緩存它將輸出的內容。使用OB捕獲錯誤?
header('Content-type: text/css');
ob_start("compress");
function compress($buffer) {
$buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
$buffer = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $buffer);
return $buffer;
}
include('layout.css');
include('pages.css');
include('form.css');
include('global.css');
ob_end_flush();
你有一個腳本運行在哪裏?在遠程服務器上?在本地服務器上?請更具體一些,否則人們不得不猜測。 – 2010-08-09 13:06:21