ez-twig

module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2022 License: Apache-2.0

README

注1:php目录的内容需要放到实际项目中,不管是开发环境,还是生产环境都需要php环境的支持

注2:我开发使用的php是7.3.7的版本

twigger = new(twig.Twig)

//这里必须是绝对路径
root, _ := os.Getwd()
Tg.ConfRoot = fmt.Sprintf("%s/twig", root) //下面的几个目录都基于这个根目录,eg:c:/wwwroot

//如果配置了PHP的环境变量可以直接使用"php"作为值
twigger.ConfPhpBinPath = "" //php.exe所在的目录,eg: d:/php73/bin/php.exe

twigger.ConfCacheDir = "" //twig缓存文件夹,eg: /var

twigger.ConfIndexPath = "" //index.php所在的目录,eg: /twig/php

twigger.ConfTwigPath = ""//模板所在的目录,eg: /twig/tpl

twigger.ConfDev = true //开发调试请开启,否则twig会使用缓存文件,修改tiwg模板后必须清空缓存;

twigger.ConfNumPipes = 10//生产生产环境使用

twigger.Init()

Twig.Render("/tpl.twig",map[string]string{"key":"value"})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL