douhao7889
2018-03-09 14:34
浏览 167
已采纳

登录页面中的错误symfony - 警告:gettext()

When I go to my page login in localhost :

mylocal.com/app_dev.php/login, I have this error :

enter image description here

An exception has been thrown during the rendering of a template ("Warning: gettext() expects exactly 1 parameter, 3 given").

On this ligne of template :

<div class="form-group">
   <input type="text" id="username" name="_username" value="{{ last_username }}" required="required" placeholder="{{ 'security.login.username'|trans }}" class="form-control" />
</div>

My composer.json :

"require": {
        "php": ">=7.1",
        "doctrine/doctrine-bundle": "^1.6",
        "doctrine/orm": "^2.5",
        "friendsofsymfony/jsrouting-bundle": "^1.6",
        "friendsofsymfony/user-bundle": "2.0.2",
        "incenteev/composer-parameter-handler": "^2.0",
        "knplabs/doctrine-behaviors": "^1.4",
        "sensio/distribution-bundle": "^5.0.19",
        "sensio/framework-extra-bundle": "^5.0.0",
        "symfony/assetic-bundle": "^2.8",
        "symfony/monolog-bundle": "^3.1.0",
        "symfony/polyfill-apcu": "^1.0",
        "symfony/swiftmailer-bundle": "^2.6.4",
        "symfony/symfony": "3.4.*",
        "twig/twig": "^2.0",
        "twig/extensions": "^1.5"
    },

My version :

php: PHP 7.2.2-3+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Feb 6 2018 16:11:23) ( NTS )

apache: Server version: Apache/2.4.18 (Ubuntu)

图片转代码服务由CSDN问答提供 功能建议

当我在localhost中登录我的页面时:

mylocal.com /app_dev.php/login,我有这个错误:

在渲染模板期间抛出了一个异常 (“警告:gettext()只需要1个参数,给定3个”)。

关于此 模板的ligne:

 &lt; div class =“form-group”&gt; 
&lt; input type =“text”id =“username”name =“_ username”  value =“{{last_username}}”required =“required”placeholder =“{{'security.login.username'| trans}}”class =“form-control”/&gt; 
&lt; / div&gt; 
 <  / code>  
 
 

我的composer.json:

 “require”:{
“php”:“&gt; = 7.1”  ,
“doctrine / doctrine-bundle”:“^ 1.6”,
“doctrine / orm”:“^ 2.5”,
“friendsofsymfony / jsrouting-bundle”  :“^ 1.6”,
“friendsofsymfony / user-bundle”:“2.0.2”,
“”boostteev / composer-parameter-handler“:”^ 2.0“,
”knplabs / doctrine-behavior“:”  ^ 1.4“,
”sensio / distribution-bundle“:”^ 5.0.19“,
”sensio / framework-extra-bundle“:”^ 5.0.0“,
”symfony / assetic-bundle“:  “^ 2.8”,
“symfony / monolog-bundle”:“^ 3.1.0”,
“symfony / polyfill-apcu”:“^ 1.0”,
“symfony / swiftmailer-bundle”:“^ 2.6  .4“,
”symfony / symfony“:”3.4。*“,
”twig / twig“:”^ 2.0“,
”twig / extensions“:”^ 1.5“
},
 <  / code>  
 
 

我的版本:

php: PHP 7.2.2-3 + ubuntu16.04.1 + deb.sury.org + 1( cli)(内置:2018年2月6日16:11:23)(NTS)

apache: 服务器版本:Apache / 2.4.18(Ubuntu)

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

5条回答 默认 最新

相关推荐 更多相似问题