Remove upload artifact using PHP

I use PHP to create supported style sheets as described in the following article: http://www.barelyfitz.com/projects/csscolor/

However, since PHP takes a little time to generate this file "dynamically", it is not cached by the client browser and shows all the elements as empty / unoccupied for a split second. Is there a way to cache CSS or remove this artifact?

Link to the site http://www.leadwerks.net/ .

Thank!

+3
source share
1 answer

CSS , , , , .

Update

, , PHP -....

header('Content-Type: text/css');

... ...

header('Expires: '.gmdate('D, d M Y H:i:s', strtotime('+1 year')).' GMT');

, CSS, ...

<?php echo $file = '/styles/custom.php' ;?>
<link rel="stylesheet"
      type="text/css"
      href="<?php echo $file; ?>?m=<?php echo filemtime($file); ?>"
/>

, CSS. , . ( ), .

+3

Source: https://habr.com/ru/post/1792118/


All Articles