您的配置文件不可序列化 [英] Your configuration files are not serializable

查看:333
本文介绍了您的配置文件不可序列化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我跑了

php artisan config:cache

在我的终端上,我得到了LogicException

on my terminal and i got a LogicException

LogicException  : Your configuration files are not serializable.

at C:\xampp\htdocs\{PROJECT}\vendor\laravel\framework\src\Illuminate\Foundation\Console\ConfigCacheCommand.php:68

 64|             require $configPath;
 65|         } catch (Throwable $e) {
 66|             $this->files->delete($configPath);
 67|
 68|             throw new LogicException('Your configuration files are not serializable.', 0, $e);
 69|         }
 70|
 71|         $this->info('Configuration cached successfully!');
 72|     }

 Exception trace:

1   Error::("Call to undefined method Closure::__set_state()")
  C:\xampp\htdocs\{PROJECT}\bootstrap\cache\config.php:241

2   require()
  C:\xampp\htdocs\{PROJECT}\vendor\laravel\framework\src\Illuminate\Foundation\Console\ConfigCacheCommand.php:64

Please use the argument -v to see more details.

在运行此命令之前,我从未遇到此错误.请任何帮助将不胜感激.谢谢.

I've never encountered this error before when running this command. Please any help will be appreciated. Thank you.

推荐答案

Laravel和整个PHP不允许闭包序列化.在配置文件中查找使用了Closures的任何文件,然后使用传统功能重写该代码段.

Closure serialization is not allowed in Laravel and PHP at large. Look through your configuration files for any file where you used Closures and rewrite that piece of code using traditional functions.

这篇关于您的配置文件不可序列化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆