我在用:
在 Tinker 和 Routing 我使用
Str::replace()
方法如 docs但得到错误:BadMethodCallException with message Method Illuminate\Support\Str::replace does not exist.
示例 1:
root@c6dd4af63e3c:/var/www/html# php artisan tinker
Psy Shell v0.10.7 (PHP 7.4.9 — cli) by Justin Hileman
>>> Illuminate\Support\Str::replace('8.x', '9.x', 'Laravel 8.x');
BadMethodCallException with message 'Method Illuminate\Support\Str::replace does not exist.'
>>>
示例2:Route::get('/test', function () {
return Illuminate\Support\Str::replace('8.x', '9.x', 'Laravel 8.x');
});
为什么会出现此错误以及如何修复?
最佳答案
字符串替换方法 Illuminate\Support\Str::replace
在 Laravel 版本中引入 v8.41.0
引用:https://github.com/laravel/framework/releases/tag/v8.41.0
关于laravel - 方法 Illuminate\Support\Str::replace 不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67974632/