mirror of
https://gitee.com/johng/gf
synced 2026-06-07 10:22:11 +08:00
添加测试文件
This commit is contained in:
@ -1,17 +1,24 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gitee.com/johng/gf/g/container/gtype"
|
||||
"gitee.com/johng/gf/g/frame/gmvc"
|
||||
"gitee.com/johng/gf/g/net/ghttp"
|
||||
)
|
||||
|
||||
func test() {
|
||||
defer fmt.Println(1)
|
||||
fmt.Println(2)
|
||||
type ControllerIndex struct {
|
||||
gmvc.Controller
|
||||
}
|
||||
func (c *ControllerIndex) Info() {
|
||||
c.View.Assign("title", "Go Frame 第一个网站")
|
||||
c.View.Assigns(map[string]interface{}{
|
||||
"name" : "很开心",
|
||||
"score" : 100,
|
||||
})
|
||||
c.View.Display("web/index.html")
|
||||
}
|
||||
|
||||
func main() {
|
||||
v := gtype.NewInt(1)
|
||||
fmt.Println(v.Set(2))
|
||||
fmt.Println(v.Set(2))
|
||||
}
|
||||
s := ghttp.GetServer()
|
||||
s.SetServerRoot("/home/john/Workspace/Go/GOPATH/src/gitee.com/johng/gf/geg/other/web/")
|
||||
s.BindController("/", new(ControllerIndex))
|
||||
s.SetPort(8199)
|
||||
s.Run()
|
||||
}
|
||||
16
geg/other/test2.go
Normal file
16
geg/other/test2.go
Normal file
@ -0,0 +1,16 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"gitee.com/johng/gf/g/os/gcron"
|
||||
"gitee.com/johng/gf/g/os/glog"
|
||||
"gitee.com/johng/gf/g/os/gtime"
|
||||
)
|
||||
|
||||
func main() {
|
||||
start := gtime.Second()
|
||||
gcron.Add("*/5 * * * * ?", func() {
|
||||
glog.Println(gtime.Second() - start)
|
||||
})
|
||||
|
||||
select{}
|
||||
}
|
||||
1
geg/other/web/index.html
Normal file
1
geg/other/web/index.html
Normal file
@ -0,0 +1 @@
|
||||
123456789
|
||||
Reference in New Issue
Block a user