Currently I'm using Windows Task Scheduler to run (every day at 8:00) a Yii2 php script.
Is there any way to change the task's start time from php (my client wants to set the task's time from an admin site dinamically)?
Thank you.
As far as I know, MSDN has an example of adding a task to run at a certain time. Also, the example has given us an outline of the steps to accomplish this:
So for starting it in php to create a task you should do something like this
//Create service object
$serviceObj= new COM("Schedule.Service");
$serviceObj->Connect();
$taskFolder = $serviceObj->GetFolder("\\");
//create the task
$oTaskDefinition = $serviceObj->NewTask(0);
//add task description
$RegistrationInfo = $oTaskDefinition->RegistrationInfo;
$RegistrationInfo->Description = "Start notepad";
$RegistrationInfo->Author = "Author Name";
You can see this article which can guide you along to complete all the above steps using php
and trigger the tasks at times
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.