Laravel 中 $request->filled 和 $request->has 区别

$request->has‌方法用于判断请求中是否包含指定的键。如果请求中包含该键,则返回true;否则返回false。例如:

if ($request->has('name')) {
    // 请求中包含'name'键
}

$request->filled‌方法用于判断请求中是否包含指定的键,并且该键的值不为空。如果请求中包含该键且值不为空,则返回true;否则返回false。例如:

if ($request->filled('name')) {
    // 请求中包含'name'键且值不为空
}