buogiorno a tutti!!
Spulciando in php.net ho trovato questo interessantissimo script che potrebbe essere utilissimo a tante persone riguardo la funzione cron().
per poter accedere a questo tipo di funzione si sa non è possibile farlo se non quando si è proprietari del server in cui viene ospitato il dominio.
ma qiando si è in hosting con un manteiner tipo aruba, altervista o altro?
ecco il codice postato in un commento sull utilizzo di ignore_user_abort()
autore:
If you want to simulate a crontask you must call this script once and it will keep running forever (during server uptime) in the background while "doing something" every specified seconds (= $interval):
cosa ne pensate? sinceramente non ho avuto il piacere di provarlo ancora...Codice PHP:
<?php
ignore_user_abort(); // run script in background
set_time_limit(0); // run script forever
$interval=60*15; // do every 15 minutes...
do{
// add the script that has to be ran every 15 minutes here
// ...
sleep($interval); // wait 15 minutes
}while(true);
?>
e per bloccarne l' esecuzione a piacere?