Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 细枝模板系统的基本和简单安装?_Php_Templates_Twig - Fatal编程技术网

Php 细枝模板系统的基本和简单安装?

Php 细枝模板系统的基本和简单安装?,php,templates,twig,Php,Templates,Twig,尝试在我的php项目中使用TWIG模板系统,这是我第一次使用这个模板系统,当我进入页面时,我发现了很多方法 还需要apache扩展才能工作吗?因为我在页面底部找到了这个 extension=twig.so #For Unix systems extension=php_twig.dll #For Windows systems 我正在Mac上开发我的脚本,我找不到Mac的示例 如果有人使用这个模板系统,你能建议我如何基本上安装这个脚本 非常感谢我找到了它 将文件夹库复制到项目中 这是示例代码

尝试在我的php项目中使用TWIG模板系统,这是我第一次使用这个模板系统,当我进入页面时,我发现了很多方法

还需要apache扩展才能工作吗?因为我在页面底部找到了这个

extension=twig.so #For Unix systems
extension=php_twig.dll #For Windows systems
我正在Mac上开发我的脚本,我找不到Mac的示例

如果有人使用这个模板系统,你能建议我如何基本上安装这个脚本

非常感谢我找到了它

将文件夹库复制到项目中 这是示例代码

require_once("/path here/lib/Twig/Autoloader.php" );

  Twig_Autoloader::register();

  $loader = new Twig_Loader_Filesystem( DIR . '/templates/');
$twig = new Twig_Environment($loader, array(
    'cache' => DIR . '/cache',
));

echo $twig->render('home.tpl', array('name' => 'Fabien'));

另外:不,PHP扩展不需要工作,它是为高负载站点设计的。