needle
待搜索的值。

haystack
待搜索的数组。

strict
如果第三个参数 strict 的值为 TRUE 则 in_array() 函数还会检查 needle 的类型是否和 haystack 中的相同。

if (!in_array($type,[1,2,3],true)) {
    $this->json->setErr(10003, '任务类型非法');
    $this->json->Send();
}

第三个参数是true的时候,很严格。如果type的值是数字1,2,3就匹配成功。如果是字符串1,2,3就会提示失败。这是个小细节。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
  • 2022-01-02
  • 2022-03-05
  • 2022-03-03
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-16
  • 2021-12-25
  • 2021-12-30
相关资源
相似解决方案