laravel 方法 Illuminate\Translation\Translator::getFromJson 不存在
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/58162258/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Method Illuminate\Translation\Translator::getFromJson does not exist
提问by Prasanth M P
After upgrading from laravel 5.8 to laravel 6.0, I found this error.
从laravel 5.8升级到laravel 6.0后,发现这个错误。
Method Illuminate\Translation\Translator::getFromJson does not exist
Method Illuminate\Translation\Translator::getFromJson does not exist
Anyone know any work around for this?
任何人都知道有什么解决办法吗?
It seems that problem is from using @lang for printing translation messages in my blade file
似乎问题出在使用 @lang 在我的刀片文件中打印翻译消息
回答by skm
Hy Prasanth
Hy Prasanth
The Lang::get and Lang::getFromJson methods have been consolidated in laravel . Calls to the Lang::getFromJson method should be updated to call Lang::get.
Lang::get 和 Lang::getFromJson 方法已合并到 laravel 中。对 Lang::getFromJson 方法的调用应更新为调用 Lang::get。
You should run the php artisan view:clear
Artisan command to avoid Blade errors related to the removal of Lang::transChoice, Lang::trans, and Lang::getFromJson.
您应该运行php artisan view:clear
Artisan 命令以避免与删除 Lang::transChoice、Lang::trans 和 Lang::getFromJson 相关的 Blade 错误。
Thank you.
谢谢你。
回答by chris_code
Try php artisan view:clear
尝试 php artisan view:clear
The issue is that your view files have been compiled in 5.8, so @lang has compiled to Lang::getFromJson
which has now been removed.
问题是您的视图文件已在 5.8 中编译,因此 @lang 已编译为Lang::getFromJson
现已删除。
回答by module-art
If php artisan view:clear
doesn't work on debian server, maybe permission is denied.
如果php artisan view:clear
在 debian 服务器上不起作用,可能是权限被拒绝。
Try sudo rm storage/framework/views/*
尝试 sudo rm storage/framework/views/*
回答by Ramesh
Please use Lang::get('your name') in laravel 6
请在 Laravel 6 中使用 Lang::get('your name')
回答by Albirrkarim
If php artisan view:clear
doesn't work
如果php artisan view:clear
不起作用
in my case view of 404,500,and more in vendor folder is the problem
在我的情况下,404,500 和更多供应商文件夹中的视图是问题所在
you can try deleting 'vendor
' folder and run composer install
again
您可以尝试删除“ vendor
”文件夹并composer install
再次运行
Good luck,
祝你好运,