Closed xiwang6428 closed 4 years ago
Laravel 6.0项目下出现如上标题的问题: Method Illuminate\Translation\Translator::trans does not exist. 因为我在Laravel模板中使用了__()或trans()等内置辅助函数,而更新后出现找不到如上trans方法问题。
composer2.0下更新后,新产生的vendor/composer/autoload_static.php文件中加载顺序变了:
'6ab8ad87a734f276a6bcd5a0fe1289be' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/operations/divideinto.php', '6124b4c8570aa390c21fafd04a26c69f' => DIR . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php', 'f960e77410032f236cef8c56617b313e' => DIR . '/..' . '/overtrue/laravel-lang/src/helpers.php', '538ca81a9a966a6716601ecf48f4eaef' => DIR . '/..' . '/opis/closure/functions.php', '801c31d8ed748cfa537fa45402288c95' => DIR . '/..' . '/psy/psysh/src/functions.php', 'e39a8b23c42d4e1452234d762b03835a' => DIR . '/..' . '/ramsey/uuid/src/functions.php', 'f0906e6318348a765ffb6eb24e0d0938' => DIR . '/..' . '/laravel/framework/src/Illuminate/Foundation/helpers.php', '58571171fd5812e6e447dce228f52f4d' => DIR . '/..' . '/laravel/framework/src/Illuminate/Support/helpers.php', '5e8fe2a5ffaded85af682684fe3bbf5a' => DIR . '/..' . '/mews/captcha/src/helpers.php',
'6ab8ad87a734f276a6bcd5a0fe1289be' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/operations/divideinto.php',
'6124b4c8570aa390c21fafd04a26c69f' => DIR . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php', 'f960e77410032f236cef8c56617b313e' => DIR . '/..' . '/overtrue/laravel-lang/src/helpers.php', '538ca81a9a966a6716601ecf48f4eaef' => DIR . '/..' . '/opis/closure/functions.php', '801c31d8ed748cfa537fa45402288c95' => DIR . '/..' . '/psy/psysh/src/functions.php', 'e39a8b23c42d4e1452234d762b03835a' => DIR . '/..' . '/ramsey/uuid/src/functions.php', 'f0906e6318348a765ffb6eb24e0d0938' => DIR . '/..' . '/laravel/framework/src/Illuminate/Foundation/helpers.php', '58571171fd5812e6e447dce228f52f4d' => DIR . '/..' . '/laravel/framework/src/Illuminate/Support/helpers.php', '5e8fe2a5ffaded85af682684fe3bbf5a' => DIR . '/..' . '/mews/captcha/src/helpers.php',
注意上方/overtrue/laravel-lang/src/helpers.php和/laravel/framework/src/Illuminate/Foundation/helpers.php的加载顺序,不知为何composer2.0将/overtrue/laravel-lang/src/helpers.php先加载了,导致后面加载的/laravel/framework/src/Illuminate/Foundation/helpers.php中的trans函数无法正常使用。因为/overtrue/laravel-lang/src/helpers.php中也有同名函数,从而出现以上问题。
暂时不知道如何解决此问题,我对composer没有深入了解。如果每次composer update后手动更改回来不现实,所以我只能暂停使用此项目改用laravel-lang/lang了。
Laravel 6.0项目下出现如上标题的问题: Method Illuminate\Translation\Translator::trans does not exist. 因为我在Laravel模板中使用了__()或trans()等内置辅助函数,而更新后出现找不到如上trans方法问题。
composer2.0下更新后,新产生的vendor/composer/autoload_static.php文件中加载顺序变了:
注意上方/overtrue/laravel-lang/src/helpers.php和/laravel/framework/src/Illuminate/Foundation/helpers.php的加载顺序,不知为何composer2.0将/overtrue/laravel-lang/src/helpers.php先加载了,导致后面加载的/laravel/framework/src/Illuminate/Foundation/helpers.php中的trans函数无法正常使用。因为/overtrue/laravel-lang/src/helpers.php中也有同名函数,从而出现以上问题。
暂时不知道如何解决此问题,我对composer没有深入了解。如果每次composer update后手动更改回来不现实,所以我只能暂停使用此项目改用laravel-lang/lang了。