从模版生成 uri Golang 的 html/template 包不太适合于这种情况

模板 - Go/Golang 框架 Echo 文档 http://go-echo.org/guide/templates/ 

 

Templates | Echo - High performance, minimalist Go web framework https://echo.labstack.com/guide/templates

 

In certain situations it might be useful to generate URIs from the templates. In order to do so, you need to call Echo#Reverse from the templates itself. Golang’s html/template package is not the best suited for this job, but this can be done in two ways: by providing a common method on all objects passed to templates or by passing map[string]interface{} and augmenting this object in the custom renderer. Given the flexibility of the latter approach, here is a sample program:

template.html

 

posted @ 2018-08-17 09:35  papering  阅读(473)  评论(0编辑  收藏  举报