在加载过程中,我在 symfony 树枝模板中遇到错误。
我需要包括这个吗:使用 Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
[无效参数异常]
Unable to find template "CrudBundle:email.html.twig".
[Twig_Error_Loader]
Unable to find template "CrudBundle:email.html.twig".
[Twig_Error_Loader]
Unable to find template "CrudBundle:email.html.twig" (looked into: C:\xampp
\htdocs\sample\vendor\symfony\symfony\src\Symfony\Bridge\Twig/Resourc
es/views/Form).
这是文件夹结构。
src/Btn/CrudBundle/command/SystemCommand.php
: 上课地点
src/Btn/CrudBundle/Resources/views/email.html.twig
: 模板位置
class SystemCommand extends ContainerAwareCommand
{
protected function configure()
{
$this
->setName('cron:email:send')
->setDescription('Verifies that accounts');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln("This is a test");
$message = \Swift_Message::newInstance()
->setSubject('Hello Email')
->setFrom('sample@sample.com')
->setTo('sample@sample.com')
->setBody(
$this->getContainer()->get('templating')->render(
'CrudBundle:email.html.twig',
array('name' => $staffer->getUser())
)
)
;
$this->get('mailer')->send($message);
}
}
请帮忙