PHP - Warning: array_filter() expects parameter 2 to be a valid callback
Warning:array_filter()expectsparameter2tobeavalidcallback,function'checkMonth'notfoundorinvalidfunctionnameinpath\to\xxxModel.phponline36
下面是相关的Code片段 - php版本:5.6:
functioncheckMonth($v){return$v==$this->month;}functiongetByMonth($month){$ret=$this->allRet;$this->month=isset($month)?$month:date("m");returnarray_filter($ret,"checkMonth");}
转而用匿名方法是正常的,所以不晓得是不是PHP版本的问题:
functiongetCourseByMonth($month){$ret=$this->allRet;$month=isset($month)?$month:date("m");returnarray_filter($ret,function($item)use($month){returndate("m",strtotime($item[1]))==$month;});}
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。