Merge pull request #772 from gin-gonic/patch-3
Improve document for #742
This commit is contained in:
		
							
								
								
									
										35
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										35
									
								
								README.md
									
									
									
									
									
								
							@ -381,8 +381,41 @@ func main() {
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### Bind Query String
 | 
			
		||||
 | 
			
		||||
See the [detail information](https://github.com/gin-gonic/gin/issues/742#issuecomment-264681292).
 | 
			
		||||
 | 
			
		||||
```go
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import "log"
 | 
			
		||||
import "github.com/gin-gonic/gin"
 | 
			
		||||
 | 
			
		||||
type Person struct {
 | 
			
		||||
	Name    string `form:"name"`
 | 
			
		||||
	Address string `form:"address"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
	route := gin.Default()
 | 
			
		||||
	route.GET("/testing", startPage)
 | 
			
		||||
	route.Run(":8085")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func startPage(c *gin.Context) {
 | 
			
		||||
	var person Person
 | 
			
		||||
	if c.Bind(&person) == nil {
 | 
			
		||||
		log.Println(person.Name)
 | 
			
		||||
		log.Println(person.Address)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	c.String(200, "Success")
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### Multipart/Urlencoded binding
 | 
			
		||||
 | 
			
		||||
###Multipart/Urlencoded binding
 | 
			
		||||
```go
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user