2
我试图使用本地化跟随,“ReflectionException”类翻译不存在
$types = trans('constants.type');
我已经创建constants.php
文件如下(在config目录下),这是它的语言文件,
/resources
/lang
/en
constants.php
/es
constants.php
constants.php
return ['type' => 'Type'];
同样的方式在其他文件翻译用相同的格式,但是这个事情给了我下面的错误
注:我在config目录下的文件中使用此,
(1/1)ReflectionException 类翻译不存在
在Container.php(线729) 在ReflectionClass - > __构建体在Container.php('译者) 在容器 - (线729) >构建('译者) 在Container.php(线608) 在容器 - >解析( '翻译') 在Container.php(线575) 在容器 - >使('译者)
问题:
trans()
方法,我在config
目录如下创建constants.php
文件不能正常工作,
/配置 constants.php
你是否修改config/app.php提供程序数组? – Kyslik
不,我没有修改它 –