PHP script to execute at certain times

后端 未结 8 1844
死守一世寂寞
死守一世寂寞 2020-12-03 19:09

Is there a simple way to have a php script execute some html at a certain times of the day?

For example i have on my home page a header and at certain times i want t

相关标签:
8条回答
  • 2020-12-03 19:52

    You could add a PHP script to your crontab to automatically run the script at defined intervals. From the command line, enter crontab -e to add the entry to your crontab.

    0 讨论(0)
  • 2020-12-03 19:53

    When you don't have access to cron jobs or scheduled tasks on your server, you can use online services such as http://pingability.com/ to hit your script at specified intervals. It is not perfect, but you can build in some kind of secret key and code that makes sure that the script doesn't get run multiple times within a certain time period. Might seem a little hacky, but I've used it on live systems to send out daily emails and it's been working fine for over a year now.

    0 讨论(0)
提交回复
热议问题