简体   繁体   中英

Run php file w/ Windows Task Scheduler

I need to execute some php scripts using the Windows Task Scheduler, I've found some similar questions but none got me to the right answer.

The script basically automatically sends emails or store them in a database if the smtp fails, which means that I'm using classes that aren't in my script (using require "myclass.php" ). So my first question : is this possible or do I have to set up every class in the same php file ?

I've set up my task like this:

C:\wamp\bin\php\php5.6.31\php.exe -f "C:\wamp\www\myproject\myscript.php"

Second question : Does it need an administrator account to execute this line ? Since launching wamp need one, I was thinking maybe php.exe needs it too.

I'm trying (if possible) to avoid using a batch file like suggested here (where the .bat is executed by the task scheduler).

问题是脚本中调用的所有类都必须在同一个 php 文件中, require("myclass.php")不起作用

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM