needle
待搜索的值。json
haystack
待搜索的数组。数组
strict
若是第三个参数 strict 的值为 TRUE 则 in_array() 函数还会检查 needle 的类型是否和 haystack 中的相同。ide
if (!in_array($type,[1,2,3],true)) { $this->json->setErr(10003, '任务类型非法'); $this->json->Send(); }
第三个参数是true的时候,很严格。若是type的值是数字1,2,3就匹配成功。若是是字符串1,2,3就会提示失败。这是个小细节。函数