Symfony 演示应用程序 - 在哪里可以找到树枝?
Symfony Demo Application - where to find twigs?
我正在尝试通过 "Symfony Demo application" 来使自己适应 Symfony 框架,并尝试通过互连工作。但是在下面的代码片段中我找不到这个树枝引用的定义 value="{{ last_username }}"
:
\app\Resources\view\security\login.html.twig
{% extends 'base.html.twig' %}
{% block body_id 'login' %}
{% block main %}
{% if error %}
<div class="alert alert-danger">
{{ error.messageKey|trans(error.messageData) }}
</div>
{% endif %}
<div class="row">
<div class="col-sm-5">
<div class="well">
<form action="{{ path('security_login_check') }}" method="post">
<fieldset>
<legend><i class="fa fa-lock"></i> Secure Sign in</legend>
<div class="form-group">
<label for="username">Username</label>
<input type="text" id="username" name="_username" value="{{ last_username }}" class="form-control"/>
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" id="password" name="_password" class="form-control" />
</div>
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}"/>
<button type="submit" class="btn btn-primary">
<i class="fa fa-sign-in"></i> Sign in
</button>
</fieldset>
</form>
</div>
</div>
我在整个演示应用程序中搜索了 last_username
,它只出现在这四个文件中:
- \app\cache\dev\classes.php
- \app\cache\prod\classes.php
- \vendor\symfony\symfony\src\Symfony\Component\Security\Core\SecurityContextInterface.php
- \vendor\symfony\symfony\src\Symfony\Component\Security\Core\Security.php
...所有这些似乎都没有提供任何有助于定义 last_username
.
的东西
last_username
参数通过在 src/AppBundle/Controller/SecurityController.php
文件中定义的 SecurityController
传递给模板。
Symfony 演示应用程序最酷的功能之一是所有页面都包含一个 Show code
,它向您显示用于创建您正在查看的页面的控制器和模板。例如,以登录页面为例:
我正在尝试通过 "Symfony Demo application" 来使自己适应 Symfony 框架,并尝试通过互连工作。但是在下面的代码片段中我找不到这个树枝引用的定义 value="{{ last_username }}"
:
\app\Resources\view\security\login.html.twig
{% extends 'base.html.twig' %}
{% block body_id 'login' %}
{% block main %}
{% if error %}
<div class="alert alert-danger">
{{ error.messageKey|trans(error.messageData) }}
</div>
{% endif %}
<div class="row">
<div class="col-sm-5">
<div class="well">
<form action="{{ path('security_login_check') }}" method="post">
<fieldset>
<legend><i class="fa fa-lock"></i> Secure Sign in</legend>
<div class="form-group">
<label for="username">Username</label>
<input type="text" id="username" name="_username" value="{{ last_username }}" class="form-control"/>
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" id="password" name="_password" class="form-control" />
</div>
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}"/>
<button type="submit" class="btn btn-primary">
<i class="fa fa-sign-in"></i> Sign in
</button>
</fieldset>
</form>
</div>
</div>
我在整个演示应用程序中搜索了 last_username
,它只出现在这四个文件中:
- \app\cache\dev\classes.php
- \app\cache\prod\classes.php
- \vendor\symfony\symfony\src\Symfony\Component\Security\Core\SecurityContextInterface.php
- \vendor\symfony\symfony\src\Symfony\Component\Security\Core\Security.php
...所有这些似乎都没有提供任何有助于定义 last_username
.
last_username
参数通过在 src/AppBundle/Controller/SecurityController.php
文件中定义的 SecurityController
传递给模板。
Symfony 演示应用程序最酷的功能之一是所有页面都包含一个 Show code
,它向您显示用于创建您正在查看的页面的控制器和模板。例如,以登录页面为例: