ada*_*m78 1 laravel laravel-5.8
我已经升级到Laravel 5.8
根据5.8中的文档所做的更改之一是,不推荐使用所有array_ *和str_ *全局帮助器(https://laravel.com/docs/5.8/upgrade#string-and-array-helpers)
在我的刀片视图中,我具有以下内容:
{{ (Arr::has($queryString, 'industry') ? Arr::get($queryString, 'industry') : '') }}
Run Code Online (Sandbox Code Playgroud)
这引发错误:
Class 'Arr' not found...
Run Code Online (Sandbox Code Playgroud)
如果我包含全名空间,则可以使用:
{{(Illuminate \ Support \ Arr :: has($ queryString,'industry')?Illuminate \ Support \ Arr :: get($ queryString,'industry'):'')}}
请指教。
I figured it out.
Need to update the app config file and include the following to the aliases array:
'Arr' => Illuminate\Support\Arr::class,
'Str' => Illuminate\Support\Str::class,
Run Code Online (Sandbox Code Playgroud)
Then clear the config cache in order for the new aliases to start working:
php artisan cache:clear
[编者注:更正了以前的错字]
| 归档时间: |
|
| 查看次数: |
625 次 |
| 最近记录: |