Ver Mensaje Individual
  #11 (permalink)  
Antiguo 31/05/2005, 17:20
Avatar de tralara
tralara
 
Fecha de Ingreso: diciembre-2003
Mensajes: 230
Antigüedad: 20 años, 5 meses
Puntos: 0
Yo le llamo "cachear" como lo que te hace la policia cuando....vsjnfjkknjenjnsfvsvf

Pues mira con este par de funciones meto unas fogatas que ni las fallas de valencia.

Código PHP:
<?php
$TIEMPO 
86400;
$dire "/ruta/para/la/fogata";
$id $_GET['id'];
function 
cache_abrir() {
global 
$TIEMPO,$dire,$id;

if(
file_exists($dire.'/'.$id.'.html') &&
time()-filemtime($dire.'/'.$id.'.html')<$TIEMPO){
include(
$dire.'/'.$id.'.html');
exit();
}
ob_start();
}
function 
cache_guardar() {
global 
$html,$dire,$id;
ob_end_clean();
$file fopen($dire.'/'.$id.'.html','w') or die("Error al intentar crear fichero.");
fwrite($file,$html) or die ("Imposible escribir en el fichero");
fclose($file);
}
?>
Y luego en cada pagina que quiero chamuscar meto:
Código PHP:
<?php
include('caching.php');
cache_abrir();
ob_start();

<<-- 
aqui metes toda la maderalos cartones y las fotos de las ex  -->>
<?
php
$html 
ob_get_contents();
ob_end_clean();
cache_guardar($html);
echo 
$html;
?>
;

Desconozco los sistemas de los que hablais pero esto funciona muy bien. Luego un cron que borre las cenizas y ala, ni bomberos ni nada!!