我在用:
在 Tinker 和 Routing 上,我使用文档中的Str::replace()方法,但出现错误:
带有消息 Method Illuminate\Support\Str::replace 的 BadMethodCallException 不存在。
示例 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.'
>>>
Run Code Online (Sandbox Code Playgroud)
示例2:
Route::get('/test', function () {
return Illuminate\Support\Str::replace('8.x', '9.x', 'Laravel 8.x');
});
Run Code Online (Sandbox Code Playgroud)
为什么会出现此错误以及如何解决?
Illuminate\Support\Str::replaceLaravel 版本引入的字符串替换方法v8.41.0
参考:https : //github.com/laravel/framework/releases/tag/v8.41.0
| 归档时间: |
|
| 查看次数: |
229 次 |
| 最近记录: |