demand:
1. Clean up the old data 30 days ago on a daily basis, such as: the current date is May 8, 2019, you need to clean up all data less than April 8, 2019
2. Directly through the sql statement
/* * Scheduled tasks, executed daily at 0:00, delete short links one month ago * 0 0 * * * /usr/local/php/bin/php 01-delete_surl.php */ $link = new mysqli('127.0.0.1', 'root', 'root', 'surl', 3306); $sql = "delete from information where information like '%articledetails%' and time < date_sub(curdate(), INTERVAL 30 DAY)"; // or // $sql = "delete from information where information like '%articledetails%' and date(time) < date_sub(curdate(), INTERVAL 30 DAY)"; mysqli_query($link, $sql) or die('Error deleting data:'. mysqli_error($link)); $link->close();