mirror of
https://gitee.com/johng/gf
synced 2026-06-26 17:35:40 +08:00
34 lines
682 B
Go
34 lines
682 B
Go
// 路由重复注册检查 - controller
|
|
package main
|
|
|
|
import (
|
|
"github.com/gogf/gf/g"
|
|
"github.com/gogf/gf/g/frame/gmvc"
|
|
)
|
|
|
|
type User struct {
|
|
gmvc.Controller
|
|
}
|
|
|
|
func (u *User) Index() {
|
|
u.Response.Write("User")
|
|
}
|
|
|
|
func (u *User) Info() {
|
|
u.Response.Write("Info - Uid: ", u.Request.Get("uid"))
|
|
}
|
|
|
|
func (u *User) List() {
|
|
u.Response.Write("List - Page: ", u.Request.Get("page"))
|
|
}
|
|
|
|
func main() {
|
|
s := g.Server()
|
|
s.BindController("/user", new(User))
|
|
s.BindController("/user/{.method}/{uid}", new(User), "Info")
|
|
s.BindController("/user/{.method}/{page}.html", new(User), "List")
|
|
s.BindController("/user/{.method}/{page}.html", new(User), "List")
|
|
s.SetPort(8199)
|
|
s.Run()
|
|
}
|