This commit is contained in:
Unknwon
2017-05-29 20:10:42 -04:00
parent cecf2b19b1
commit 9b34b13da1
2 changed files with 2 additions and 2 deletions

View File

@@ -83,7 +83,7 @@ type HandlerFunc func(ResponseWriter, *Request)
```
它是一个可以把普通的函数当做HTTP处理器的适配器。如果`f`函数声明的合适,`HandlerFunc(f)`就是一个执行了`f`函数的处理器对象。
`http.Handle`的第二个参数也可以是`T`的一个obj对象`http.Handle("/", obj)`给T提供了`SereHTTP`方法实现了http的`Handler`接口:
`http.Handle`的第二个参数也可以是`T`的一个obj对象`http.Handle("/", obj)`给T提供了`ServeHTTP`方法实现了http的`Handler`接口:
```go
func (obj *Typ) ServeHTTP(w http.ResponseWriter, req *http.Request) {
...