如何每天自动运行 php 脚本?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13313624/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 05:08:45  来源:igfitidea点击:

How to run a php script automatically daily?

phpmysqlcron

提问by Pramod Gupta Bavirisetty

Possible Duplicate:
How to run a php script in cron

可能的重复:
如何在 cron 中运行 php 脚本

I need to run a php script at the scheduled time daily to update some fields in database and to send automated email. How I can do this?

我需要每天在预定时间运行一个 php 脚本来更新数据库中的某些字段并发送自动电子邮件。我怎么能做到这一点?

Is it possible to write some service in XAMP server to run the script daily at scheduled time? I have no idea how to update database and send email automatically at the scheduled time. Can any one share some ideas or concepts?

是否可以在 XAMP 服务器中编写一些服务来每天在预定时间运行脚本?我不知道如何更新数据库并在预定时间自动发送电子邮件。任何人都可以分享一些想法或概念吗?

I am using PHP and MySQL running in Linux Server.

我正在使用在 Linux 服务器上运行的 PHP 和 MySQL。

回答by Jason McCreary

Is it possible to write some service in XAMP server to run the script daily at scheduled time?

是否可以在 XAMP 服务器中编写一些服务来每天在预定时间运行脚本?

Create a Cron Job.

创建Cron 作业

回答by R Ghosh

Look into CRON Jobs: http://en.wikipedia.org/wiki/CronThey will allow you to schedule multiple scripts to run automatically, without your intervention on a determined schedule.

查看 CRON 工作:http: //en.wikipedia.org/wiki/Cron他们将允许您安排多个脚本自动运行,而无需您按照确定的时间表进行干预。

回答by doniyor

you should use cron job, it will run your script automatically

您应该使用 cron 作业,它会自动运行您的脚本

http://www.thegeekstuff.com/2011/07/php-cron-job/

http://www.thegeekstuff.com/2011/07/php-cron-job/