Possible Duplicate:
PHP: running scheduled jobs (cron jobs) How can I make my PHP script run at a certain time everyday?
I basically need a way to run a script that's going to check if someone has attended an event and at 12am, add the event to a u开发者_如何转开发ser's events table. I can get that part no problem. I just need it to run every day at the end of the day or first thing in the morning (12am). It's going to be a php script. How can I make this run everyday at 12am?
If you have access to the host you're running on and it's a UNIX-like machine, using cron
would be your best bet.
You can use a scheduler to run the script for you at the specified time. For example, if you're on Linux, you could use cron. http://en.wikipedia.org/wiki/Cron
Make a cron job/scheduled task and start the php cli like "php.exe myscript.php" at 12am.
Your best bet is a cron job. If you're on shared hosting, this is usually available by going to cPanel and selecting "Cron tasks" or something similar.
See cron.
Create a bash script and run it as a cronjob
精彩评论