如何使用php和xampp在Windows任务计划中设置cron作业的查询?

时间:2017-07-07 10:38:59

标签: php cron xampp scheduled-tasks

基本上我想要任何用户在系统中注册自己。创建日期为1个月后,应自动从db中删除用户 在我的表格中,我有creationDate列。我完成了我的系统创建调度程序。它的工作。我只是想知道将为我的事情设置什么样的查询 下面是我的cron.php代码:

<?php
include 'db.php';
$sql  = mysqli_query($conn,'select  *  from user where createdDate<=CURRENT_DATE - INTERVAL 3 DAY');
$data = mysqli_num_rows($sql);
if($data > 0)
{   
    while ($row = mysqli_fetch_array($sql)) 
        {           
            $id = $row['userId'];
            $sql = mysqli_query($conn, "DELETE FROM user where userId='".$id."'");
        }

}
?>

1 个答案:

答案 0 :(得分:0)

  

按照以下方法使用 powershell

命中您的文件/功能


打开Windows任务计划

  • 创建基本任务向导
  • 根据您的要求设置跳跳选项
  • 将操作设置为&#34;启动程序&#34;
  • 设置程序/脚本= powershell
  • 添加参数command = PowerShell Invoke-WebRequest -Uri http://domainName/functionName -Method GET
  • 完成它,然后使用高级设置编辑触发器以无限期地设置每分钟