<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                模板函數 beego 支持用戶定義模板函數,但是必須在 beego.Run() 調用之前,設置如下: ~~~ func hello(in string)(out string){ out = in + "world" return } beego.AddFuncMap("hi",hello) ~~~ 定義之后你就可以在模板中這樣使用了: ~~~ {{.Content | hi}} ~~~ beego 內置的模板函數: ~~~ |-- admin | |--controllers | `-- user.go ~~~ ~~~ package admin import ( "time" "github.com/astaxie/beego" ) type UserController struct { beego.Controller } func (this *UserController) Index() { // 函數 dateformat , 函數 date this.Data["time"] = time.Now() // 函數 compare this.Data["A"] = "A" this.Data["B"] = "B" // 函數 substr this.Data["str"] = "hello world!" // 函數 html2str this.Data["htmlInof"] = `<? W3S?h??!??>this is function html2str <dfdjfdk>` // 函數 str2html this.Data["strHtml"] = `<h3>this is function html2str </h3>` // 函數 htmlquote this.Data["quote"] = `<h3>this is function html2str </h3>` // 函數 htmlunquote this.Data["unquote"] = `&lt;h3&gt;this&nbsp;is&nbsp;function&nbsp;html2str&nbsp;&lt;/h3&gt;` // 函數 renderform type stu struct { Name string `form:"user_name"` Age int `form:"user_age"` Class int } // <input name="user_name" type="text" value=""> // <input name="user_age" type="text" value="0"> // <input name="Class" type="text" value="0"> this.Data["struct"] = &stu{} // 函數 assets_js this.Data["js_src"] = "./public/js/test.js" // <script src="./public/js/test.js"></script> // 函數 assets_css this.Data["css_src"] = "./public/css/test.css" // <link href="./public/css/test.css" rel="stylesheet"> // 函數 map_get this.Data["map"] = map[string]interface{}{ "key1": "value1", "key2": map[string]string{"key3": "value2"}, } this.TplName = "admin/user/index.html" } ~~~ ~~~ |-- views | |--admin | |--user | `-- index.html ~~~ ~~~ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> this is view admin/user/index.html <br/> 函數 dateformat :<br/> <!-- 實現了時間的格式化,返回字符串 --> {{dateformat .time "2006-01-02 15:04:05"}} <br/> 函數 date :<br/> <!-- 實現了類似 PHP 的 date 函數,可以很方便的根據字符串返回時間 --> {{date .time "Y-m-d H:i:s"}}<br/> 函數 compare :<br/> <!-- 實現了比較兩個對象的比較,如果相同返回 true,否者 false --> { {compare .A .B} } => {{compare .A .B}}<br/> 函數 substr :<br/> <!-- 實現了字符串的截取,支持中文截取的完美截取 --> {{substr .str 0 6}}<br/> {{substr .str 6 20}}<br/> 函數 html2str :<br/> <!-- 實現了把 html 轉化為字符串,剔除一些 script、css 之類的元素,返回純文本信息 --> {{html2str .htmlInof}}<br/> 函數 str2html :<br/> <!-- 實現了把相應的字符串當作 HTML 來輸出,不轉義 --> {{str2html .strHtml}}<br/> 函數 htmlquote :<br/> <!-- 實現了基本的 html 字符轉義 --> {{htmlquote .quote}}<br/> 函數 htmlunquote :<br/> <!-- 實現了基本的反轉移字符 --> {{htmlunquote .unquote}}<br/> 函數 renderform :<br/> <!-- 根據 StructTag 直接生成對應的表單 --> {{.struct | renderform}}<br/> 函數 assets_js :<br/> <!-- 為 js 文件生成一個 <script> 標簽. --> {{assets_js .js_src}}<br/> 函數 assets_css :<br/> <!-- 為 css 文件生成一個 <link> 標簽. --> {{assets_css .css_src}} 函數 config :<br/> <!-- 獲取 AppConfig 的值. 可選的 configType 有 String, Bool, Int, Int64, Float, DIY --> {{config "String" "appname" "default"}}<br/> 函數 map_get :<br/> <!-- 獲取 map 的值 --> {{map_get .map "key1"}}<br/> {{map_get .map "key2" "key3"}}<br/> 函數 urlfor :<br/> <!-- 獲取控制器方法的 URL --> {{urlfor "UserController.Index"}} </body> </html> ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看