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)

  • 写回答

5条回答 默认 最新

  • dongtanghuan1885 2018-03-13 15:42
    关注

    If you use Twig-extensions, it may com from the i18n Extension. So to quickly fix it, juste disable the i18n Extension.

    http://twig-extensions.readthedocs.io/en/latest/i18n.html

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料