首页 > 其他 > 详细

Warning: array_filter() expects parameter 2 to be a valid callback

时间:2016-06-11 07:08:31      阅读:428      评论:0      收藏:0      [点我收藏+]
Warning:  array_filter() expects parameter 2 to be a valid callback, function ‘checkMonth‘ not found or invalid function name in path\to\xxxModel.php on line 36

下面是相关的Code片段 - php版本:5.6:

function checkMonth($v){
    return $v == $this->month;
}
function getByMonth($month){
    $ret = $this->allRet;
    $this->month = isset($month)?$month:date("m");
    return array_filter($ret, "checkMonth");
}


转而用匿名方法是正常的,所以不晓得是不是PHP版本的问题:

function getCourseByMonth($month){
    $ret = $this->allRet;
    $month = isset($month)?$month:date("m");
    return array_filter($ret, function($item) use($month){
        return date("m", strtotime($item[1])) == $month;
    });
}


Warning: array_filter() expects parameter 2 to be a valid callback

原文:http://lybing.blog.51cto.com/3286625/1787870

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!