小编Iva*_*ño 的帖子

Symfony 4:您请求了一个不存在的参数“locale”

当我在我的 Symfony 4 应用程序(已经在共享托管服务中在线)中启用“开发”模式时,它会显示以下消息:

(1/1) ParameterNotFoundException
You have requested a non-existent parameter "locale".

in ParameterBag.php (line 100)
at ParameterBag->get('locale')
in EnvPlaceholderParameterBag.php (line 57)
at EnvPlaceholderParameterBag->get('locale')
in ParameterBag.php (line 216)
at ParameterBag->resolveString('%locale%', array('locale' => true))
in ParameterBag.php (line 187)
...
Run Code Online (Sandbox Code Playgroud)

并且不允许调试应用程序。我的 config/services.yml 代码是默认的:

# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
    locale: 'en'

services:
    # default configuration for Services in *this* file
    _defaults:
        autowire: true      # Automatically injects dependencies …
Run Code Online (Sandbox Code Playgroud)

php symfony

4
推荐指数
2
解决办法
7787
查看次数

标签 统计

php ×1

symfony ×1