这是我的路线Symfony的2 - 不能得到变量
homepage:
pattern: /{name}.{ext}
defaults:
_controller: DprocMainBundle:Index:index
name: index
ext: php
requirements:
ext: php
name: index
,我想在我的树枝模板来显示(名称)。所以控制器得到变量,并通过数组将其发送
class IndexController extends Controller
{
public function indexAction($index)
{
return $this->render('DprocMainBundle:Dproc:index.html.twig', array('index' => $index));
}
}
意见
<title>{% block title %}Welcome - {{ name }}{% endblock %}</title>
有错误:
Controller "Dproc\MainBundle\Controller\IndexController::indexAction()" requires that you provide a value for the "$index" argument (because there is no default value or because there is a non optional argument after this one).
将'$ index'更改为'$ name' – tttony