开发者

Trigger PHP scripts from server

Fairly new to PHP but in the middle of building an admin panel for a booking system. Just a question for the future.

Lets say a user has not confirmed their booking. When 20 days remain say until their start date I would like a PHP to trigger that sends them out an email and alters some text on their account.

All this I know how to do if I bring up a page that queries on those basise.

How would I just get the server to do that automatically. So rather than me or 开发者_StackOverflow中文版the user go to their booking and it to trigger the PHP script for the server to simply execute it at a certain time anyway.

Any ideas?

Marvellous


Cron. What you want is a daily cron job that runs a php script.

On most hosting control panels there's a cron tool somewhere. You just need to set up the command for it to do and when do to it. It would wind up something like 0 0 * * * * /fullpath/to/php /fullpath/to/script.php to run the script every day at midnight.

If the script is web accessible, there are free web cron services, where you can set them up to access the script whenever you want. Of course, you'd want some extra security on it in that case.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜