0

In my current project, I have a table full of drivers' information with a column containing the expiration dates of their drivers' licenses.

I want to send an alert email when their license expires in the next 20 days. I want this check to happen on a daily basis.

If I bind this to an action such as a user's login, I'm afraid it may be missed in certain cases (like a weekend when no one logs in) etc.

Is there a way to do this check routinely without any user intervention? I'm using CodeIgniter as my PHP framework. My project's running on a shared hosting account with PHP 5.3 and MySql 5.

4

1 回答 1

1

You can create a controller which triggers the checks/emails etc in some way shape or form, then simply run CI via the command line in a Cronjob which runs per minute/hour/day etc

$ cd /path/to/project && php index.php tools message

As you're on shared hosting, you probably don't have access to Crontab, there are various services such as http://www.mywebcron.com/ which you can set up Cronjobs on. Obviously in this case the above is only part valid- rather than use php in the command line, you'd need to use wget (or similar) to access the controller via HTTP.

于 2013-03-29T16:59:18.830 回答