我創建了一個自定義應用程序,我喜歡將一些PHP變量傳遞給CSS。PHP頭過期檢查
我使用的方法,是一種style.php文件服務CSS頭,所以HTTP請求它解決了請求作爲一個正常的CSS文件。
這種方法的問題是,在每一個請求,我必須加載在內存中的一些大型PHP文件。
我喜歡做的是檢查文件的截止日期,如果該文件還沒有到期,則不能運行該腳本,而是發送緩存的文件。
那麼,有沒有對這個問題的任何解決方案?
我的PHP文件,我喜歡看起來像這樣的事情:
<?php
// Enter here several headers to cache the file and other operations
// Check here if the file must be re-executed or load a cached version instead
// Enter here the inclution of my application scripts with include_once(....)
?>
body
{
background-color: <?php echo $options->css['bg_color']; ?>
}
親切的問候 Merianos尼科斯
CSS您多久改變一次?通常,在部署應用程序時,更容易重新創建樣式表,因爲在部署之間它們不會改變。 – KingCrunch 2012-03-12 11:28:36
檢查確切文件的到期日期?您如何期待維持到期日期? – deed02392 2012-03-12 11:32:05
我不是指文件的到期時間。將爲CSS提供服務的php文件將有頭文件(....)用於過期,並且我希望檢查頭文件過期。 – 2012-03-12 11:40:34