为了账号安全,请及时绑定邮箱和手机立即绑定

array_filter的回调返回null

array_filter的回调返回null

PHP
慕勒3428872 2019-03-07 20:56:19
为何会返回NULL无法理解 dump($info); dump(function_exists('wx_user_info_filter')); dump(wx_user_info_filter('groupid')); dump(array_filter($info,'wx_user_info_filter',ARRAY_FILTER_USE_KEY)); /** * @param $k * @return bool */ function wx_user_info_filter($k){ $arr=array('groupid','subscribe_scene','tagid_list','qr_scene','qr_scene_str'); if((boolean) in_array(strtolower($k),$arr)){ return false; }else{ return true; } } array(17) { ["subscribe"] => int(1) ["openid"] => string(28) "xxxxxxxx" ["nickname"] => string(11) "xxxxxxxx" ["sex"] => int(1) ["language"] => string(5) "xxxxxxxx" ["city"] => string(6) "xxxxxxxx" ["province"] => string(6) "xxxxxxxx" ["country"] => string(6) "xxxxxxxx" ["headimgurl"] => string(133) "xxxxxxxx" ["subscribe_time"] => int(1540366847) ["remark"] => string(0) "" ["groupid"] => int(0) ["tagid_list"] => array(0) { } ["subscribe_scene"] => string(16) "ADD_SCENE_SEARCH" ["qr_scene"] => int(0) ["qr_scene_str"] => string(0) "" ["group_id"] => int(0) } bool(true) bool(false) NULL
查看完整描述

1 回答

?
ABOUTYOU

TA贡献1812条经验 获得超5个赞

升级你的php版本

php5.4不支持ARRAY_FILTER_USE_KEY

https://img1.sycdn.imooc.com//5c8f3abb0001cd1308000151.jpg

============

php 7.1 没有复现。

查看完整回答
反对 回复 2019-03-18
  • 1 回答
  • 0 关注
  • 448 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信