我是Twig的第一天用户,我有一些奇怪的引擎行为。 我将一些信息推到我的观点:
class MainController extends Controller {
public function actionIndex()
{
$template = self::$twig->loadTemplate('index.php');
$title = 'CRUD интерфейс';
$projects = MainList::showAll();
$workers = CompanyWorker::showAll();
$roles = Role::showAll();
$namesOfProjects = Project::showAll();
echo $template->render(array(
'title' => $title,
'projects' => $projects,
'workers' => $workers,
'roles' => $roles,
'namesOfProjects' => $namesOfProjects
));
}
}
最后我有一个很好的结果但是在HTML文件的最后,twig显示了我的控制器对象。它为什么会发生?
这是我的Twig初始化: 抽象类控制器{
public $loader;
static $twig;
function __construct()
{
$this->loader = new Twig_Loader_Filesystem('views');
//$twig = new Twig_Environment($loader, array('cache' => 'cache'));
self::$twig = new Twig_Environment($this->loader);
}
答案 0 :(得分:0)
我是盲人8 [。我真的很想念' print_r'闪光功能