PHP定时执行任务
PHP定时执行任务有两种方式: 一、Linux 服务器 Linux原生支持crontab,所以可以利用这一功能做定时任务 步骤: 1、编辑crontab文件: Linux:crontab -e 2、输入代码: 0 0 * * 6 /etc/init.d/httpd restart && /etc/init.d/mysqld restart 代码解释:每周六0点自动重启apache和mysql,第一项(前面5位)是时间设置,具体格式百度之,不赘述,下同; 第二项是apache所在目录, 第三项上执行具体方法, 后面的&&可以连写,也可以删除&&后,换行,即也可以这么写: 0 0 * * 6 /etc/init.d/httpd restart 0 0 * * 6 /etc/init.d/mysqld restart 0 9 * * * /usr/bin/curlhttp://www.website.com/Index/test 代码解释:每天上午9点自动执行一次http://www.website.com/Index/test方法 第二项代表...