为服务器编写时间相关的PHP脚本

Is there a way with PHP to execute PHP functions based on time of day or day of week? I.e. store information to a database every wednesday? That is, without anyone viewing a web page or click a link to check if it wednesday each time? Any help would be great on this. I need a way to read information from a db and write it to a file every so often, i.e. once a week on my server. How can I accomplish these time dependent tasks? Thanks!

You're looking for crontab (for Linux) or Scheduled Tasks (for Windows). You can execute any PHP file directly from the server by running the PHP executable on it.

(Windows) Example:

php.exe -f P:\ath\to\php\file.php

Your best bet is to set your PHP script to run in Cron.

http://en.wikipedia.org/wiki/Cron