如何使用 laravel 8 中的一个函数检查变量是否为 null 或为空?

How can check variables is null or empty with one function in laravel 8?

我想检查 laravel 8 中是否有一个函数,例如 IsNullOrEmpty for C# 仅使用一个函数来检查空值和空值。

可以使用empty()PHP函数。 empty() 函数检查变量是否为空。

如果变量存在且不为空,此函数returns false,否则returns true。

以下值的计算结果为空:

  1. 0
  2. 0.0
  3. “0”
  4. ""
  5. 错误
  6. 数组()