我尝试了各种方法来解决这个问题,例如清除缓存,作曲家更新/安装,但是在
php artisan config:cache
之后,它再次出现。
在 config.php 第 839 行:
调用未定义的方法 Illuminate\Validation\Rules\In::__set_state()
整页变成空白页。 在 bootstrap/cache/config.php 文件中显示:
'environment' =>
array (
'form' =>
array (
'rules' =>
array (
'app_name' => 'required|string|max:50',
'environment' => 'required|string|max:50',
'environment_custom' => 'required_if:environment,other|max:50',
'app_debug' =>
array (
0 => 'required',
1 =>
Illuminate\Validation\Rules\In::__set_state(array(
'rule' => 'in',
'values' =>
array (
0 => 'true',
1 => 'false',
),
)),
),
我也遇到了这个错误,因为而不是
“阐明\验证\规则”
我已经放了
“阐明\合约\验证\规则”
这是
laravel/framework/src/Illuminate/Validation
软件包的问题。
在
Rules
文件夹中,我们有名为 In
的类(文件 In.php
)
缺少功能
__set_state
.
如果您要在此类中添加以下功能,
static public function __set_state($array = []){
return 'boolean';
}
问题将会得到解决。另外,它是临时解决方案(composer安装/更新命令可以删除您的功能)
享受...
我认为您有一些带有验证规则的配置文件。验证您是否有
config/environment.php
文件或验证其他配置文件。
我认为其中之一你有:
Rule::in([true, false]);
您不应该在配置文件中使用此语法,因为它无法缓存,而是应该使用:
'in:1,0'
然而,在配置文件中保留任何验证规则似乎很奇怪。
只需删除文件config.php
来自引导程序/缓存/
然后跑
command composer dumpautoload
比
php artisan config:cache
它对我有用
添加此代码:
use Illuminate\Validation\Rule;
用
Rule::in([true, false]);
更改 'in:1,0'
对我有用。我还需要删除 bootstrap/cache/config.php 中对 Rule 类的所有奇怪引用。
只需删除文件
配置.php
来自
引导/缓存/
然后运行命令
composer dumpautoload
比
php artisan config:cache
检查您的 config/installer.php 文件是否包含 app_debug 上规则 Rule::in([true, false]) 的定义。如果是这样,请将其替换为:
'app_debug' => '必需',
这应该可以解决问题。
问候,