Merge pull request #306 from mrhuo/patch-1

Update 15.2.md
This commit is contained in:
无闻
2017-01-22 09:53:40 -05:00
committed by GitHub

View File

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