中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁(yè) > news >正文

網(wǎng)站開發(fā)架設(shè)baidu百度

網(wǎng)站開發(fā)架設(shè),baidu百度,市住房和城鄉(xiāng)規(guī)劃建設(shè)局網(wǎng)站,屬于自己的網(wǎng)站go-bindata - embed結(jié)合嵌入靜態(tài)文件打包可執(zhí)行二進(jìn)制文件 ## embed 嵌入靜態(tài)文件到可執(zhí)行二進(jìn)制文件 # 安裝go-bindata go get -u github.com/jteeuwen/go-bindata/... # 打包靜態(tài)文件 go-bindata web/... 執(zhí)行次命令之后會(huì)在項(xiàng)目目錄下生成bindata.go文件,示例命令中模板文…

go-bindata - embed結(jié)合嵌入靜態(tài)文件打包可執(zhí)行二進(jìn)制文件

## embed 嵌入靜態(tài)文件到可執(zhí)行二進(jìn)制文件
# 安裝go-bindata

go get -u github.com/jteeuwen/go-bindata/...



# 打包靜態(tài)文件

go-bindata web/...


執(zhí)行次命令之后會(huì)在項(xiàng)目目錄下生成bindata.go文件,示例命令中模板文件都在項(xiàng)目的web目錄下

# 使用embed注冊(cè)模板示例文檔

https://github.com/kataras/iris/blob/main/_examples/view/embedding-templates-into-app/main.go

https://github.com/kataras/iris/blob/main/_examples/view/embedding-templates-into-app/main.go



示例代碼:

package mainimport (
"embed"
"github.com/kataras/iris/v12"
)//go:embed embedded/*
var embeddedFS embed.FSfunc main() {
app := iris.New()tmpl := iris.HTML(embeddedFS, ".html").RootDir("embedded/templates")tmpl.Layout("layouts/layout.html")
tmpl.AddFunc("greet", func(s string) string {
return "Greetings " + s + "!"
})app.RegisterView(tmpl)app.Get("/", func(ctx iris.Context) {
if err := ctx.View("page1.html"); err != nil {
ctx.HTML("<h3>%s</h3>", err.Error())
return
}
})// remove the layout for a specific route
app.Get("/nolayout", func(ctx iris.Context) {
ctx.ViewLayout(iris.NoLayout)
if err := ctx.View("page1.html"); err != nil {
ctx.HTML("<h3>%s</h3>", err.Error())
return
}
})// set a layout for a party, .Layout should be BEFORE any Get or other Handle party's method
my := app.Party("/my").Layout("layouts/mylayout.html")
{ // both of these will use the layouts/mylayout.html as their layout.
my.Get("/", func(ctx iris.Context) {
if err := ctx.View("page1.html"); err != nil {
ctx.HTML("<h3>%s</h3>", err.Error())
return
}
})
my.Get("/other", func(ctx iris.Context) {
if err := ctx.View("page1.html"); err != nil {
ctx.HTML("<h3>%s</h3>", err.Error())
return
}
})
}// http://localhost:8080
// http://localhost:8080/nolayout
// http://localhost:8080/my
// http://localhost:8080/my/other
app.Listen(":8080")
}

http://www.risenshineclean.com/news/40527.html

相關(guān)文章:

  • 如何打開本地安裝的WORDPRESS網(wǎng)站查詢工具seo
  • 合肥建設(shè)學(xué)校官網(wǎng)網(wǎng)站網(wǎng)站關(guān)鍵詞挖掘
  • html5移動(dòng)網(wǎng)站模板貴港網(wǎng)站seo
  • 怎么兼職做網(wǎng)站谷歌seo站內(nèi)優(yōu)化
  • 用網(wǎng)站模板建網(wǎng)站谷歌官網(wǎng)注冊(cè)入口
  • 一個(gè)網(wǎng)站想看訪客量怎么做seo外鏈平臺(tái)
  • 青浦網(wǎng)站建設(shè)公司福州短視頻seo推薦
  • 網(wǎng)站風(fēng)格設(shè)計(jì)百度seo怎么樣優(yōu)化
  • 網(wǎng)站建設(shè)文化怎么樣圖片百度搜索
  • 簡(jiǎn)單的招聘網(wǎng)站怎么做電商網(wǎng)站設(shè)計(jì)
  • 手機(jī)哪里可以做視頻網(wǎng)站鄭州聚商網(wǎng)絡(luò)科技有限公司
  • 勁松做網(wǎng)站的公司百度一下首頁(yè)設(shè)為主頁(yè)
  • wordpress中文 插件網(wǎng)站文章優(yōu)化技巧
  • 做網(wǎng)站北京公司推廣產(chǎn)品的渠道
  • drupal7建站教程怎么創(chuàng)建網(wǎng)站鏈接
  • 重慶微網(wǎng)站建設(shè)寧波網(wǎng)絡(luò)推廣軟件
  • 自適應(yīng)網(wǎng)站設(shè)計(jì)規(guī)范企業(yè)的互聯(lián)網(wǎng)推廣
  • 如何建設(shè)dj網(wǎng)站seo 工具推薦
  • 成都網(wǎng)站制作創(chuàng)新互聯(lián)磁力搜索引擎哪個(gè)好
  • 寬屏企業(yè)網(wǎng)站源碼國(guó)家再就業(yè)免費(fèi)培訓(xùn)網(wǎng)
  • 遵義做網(wǎng)站的公司重慶電子商務(wù)網(wǎng)站seo
  • 家用電腦如何做網(wǎng)站服務(wù)器百度總部公司地址在哪里
  • 做網(wǎng)站可以用什么語(yǔ)言長(zhǎng)春網(wǎng)站優(yōu)化平臺(tái)
  • 購(gòu)物網(wǎng)站建設(shè)公司網(wǎng)絡(luò)營(yíng)銷管理名詞解釋
  • wordpress國(guó)內(nèi)支付上海搜索優(yōu)化推廣
  • html可以做動(dòng)態(tài)網(wǎng)站嗎我是seo關(guān)鍵詞
  • 應(yīng)用商城下載seo服務(wù)是什么
  • 怎么用文件做網(wǎng)站快速優(yōu)化網(wǎng)站排名軟件
  • 淄博桓臺(tái)網(wǎng)站建設(shè)報(bào)價(jià)湘潭關(guān)鍵詞優(yōu)化公司
  • erp系統(tǒng)軟件免費(fèi)版優(yōu)化營(yíng)商環(huán)境心得體會(huì)2023