Twig显示源代码,但不显示HTML

Twig显示源代码,但不显示HTML,twig,Twig,我试图在PHP项目(Wamp)中运行Twig(独立,没有Symfony 2),但它不起作用:Twig显示模板源代码,但不执行HTML。我不知道为什么。这是我的密码: index.php: // DOCUMENT_ROOT (constant defined in a previous included file) : C:/Program Files/wamp/www/project $sTwigPath = DOCUMENT_ROOT."/vendors/twig/lib/Twig/Autol

我试图在PHP项目(Wamp)中运行Twig(独立,没有Symfony 2),但它不起作用:Twig显示模板源代码,但不执行HTML。我不知道为什么。这是我的密码:

index.php:

// DOCUMENT_ROOT (constant defined in a previous included file) : C:/Program Files/wamp/www/project
$sTwigPath = DOCUMENT_ROOT."/vendors/twig/lib/Twig/Autoloader.php";

if (file_exists($sTwigPath)) {
    require($sTwigPath);

    Twig_Autoloader::register();
    $loader = new Twig_Loader_Filesystem(DOCUMENT_ROOT."/templates");
    $tpl = new Twig_Environment($loader, array("cache"=>false));

try {
    $oTemplate = $tpl->loadTemplate("home.html");
} catch (Twig_Error_Loader $e) {
    error_log("Twig library not found", 0);
    exit;
}    

$aRender = array();
$aRender["myVar"] = "Wouah! myVar is displayed here!";

echo $oTemplate->render($aRender);
home.html:

<!DOCTYPE html>
<html>
<head>  
   <meta charset="UTF-8">
   <title>Home</title>
 </head>
 <body>
    <h1>Home</h1>
    {{myVar}}
 </body>
 </html>      

家
家
{{myVar}}

我没有错误(检查PHP和apache日志)

好奇的是,您是否尝试过使用选项
array('cache'=>false,'debug'=>true,'auto_reload'=>true)
创建Twig_环境?您所说的“不执行HTML”是什么意思?
{{myvar}}
是否被替换?请在模板文件的最开始处尝试:{%autoescape false%}在最后使用{%endautoescape%}让我们知道现在发生了什么