Home > Backend Development > PHP Problem > How to implement schedule reminder in php

How to implement schedule reminder in php

藏色散人
Release: 2023-03-14 16:20:02
Original
2486 people have browsed it

php method to implement schedule reminder: 1. Create a PHP sample file; 2. Get the configuration of the scheduled task, code such as "$timing_task=api_base::load_config('zip_remove');if($timing_task. ..){...}".

How to implement schedule reminder in php

#The operating environment of this article: Windows 7 system, PHP version 7.1, Dell G3 computer.

How to implement schedule reminder in php? How to implement scheduled reminder function in PHP?

For example, if you want to implement such a function: you can automatically send a message to the user on the user's birthday or a few days in advance. Or you can automatically send information to users two or three days before the membership expiration date. How can you use PHP language to automatically implement such a function?

Implementation method:

It is recommended to use workerman or swoole

//获取定时任务的配置
        $timing_task=api_base::load_config('zip_remove');
        if($timing_task['is_remove']){
            
            \Man\Core\Lib\Task::add($timing_task['time_interval'], function(){
                $zip_remove=api_base::load_sys_class('zpi_file');
                
                $zip_xml_config=api_base::load_config('zip_xml');
                $zip_path=$zip_xml_config['BCP_PATH'][0]['val'];
                $timing_task=api_base::load_config('zip_remove');
                if(!empty($timing_task['delete_zip_time'])){
                    if(date('H:i',time())==$timing_task['delete_zip_time']){
                        $zip_remove=new zpi_file();
                        $zip_remove->remove_zip_file($zip_path);
                    }
                }else{
                    $zip_remove=new zpi_file();
                    $zip_remove->remove_zip_file($zip_path);
                }
                    
            });
        }
Copy after login

workerman is probably this syntax

Recommended learning:《PHP video tutorial

The above is the detailed content of How to implement schedule reminder in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template