gf/.example/os/gcron/gcron2.go

21 lines
255 B
Go

package main
import (
"time"
"github.com/gogf/gf/os/gcron"
"github.com/gogf/gf/os/glog"
)
func test() {
glog.Println(111)
}
func main() {
_, err := gcron.AddOnce("@every 2s", test)
if err != nil {
panic(err)
}
time.Sleep(10 * time.Second)
}