Home  >  Article  >  Backend Development  >  计划任务施行PHP脚本

计划任务施行PHP脚本

WBOY
WBOYOriginal
2016-06-13 11:19:29861browse

计划任务执行PHP脚本
项目里有个发邮件的脚本,需要每隔两分钟去数据库读取没有发送的邮件,然后发送出去。我在浏览器中运行没有问题。但因为需要一直运行,就想用windows的计划任务来定时执行。
bat文件是这么写的:

D:\wamp\bin\php\php5.4.3\php.exe -q D:\wamp\www\cron\mailqueue-2min.php

但执行的话,总是发送失败。
请教一下这是哪的问题。 难道php.exe执行和浏览器运行有什么区别?


------解决方案--------------------
参数应该用 -f 吧
------解决方案--------------------
D:\wamp\www\cron\mailqueue-2min.php  里面如果有reqiure或者include的请用绝对地址,就是这个问题!
------解决方案--------------------
D:\wamp\bin\php\php5.4.3\php.exe D:\wamp\www\cron\mailqueue-2min.php
把中间的-q去掉看看
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn