array_map()期望参数1成为有效的回调,类'搜索'没有方法' wishList'
$shops = array_map(array($this, 'wishList'), $shops);
function wishList($shops) {
print_r(shops);
$this->check_authentication();
$user = $this->getUser();
$shops->isWishList = $this->Wishlist_model->_isShopInMyWishList($shops->id, $user->id,6) ? true : false;
return $shops;
}
答案 0 :(得分:0)
对于我看到的问题,你刚刚宣布你的wishList
函数不在Search
类中,如果你想这样做,你应该这样写:
$shops = array_map('wishList', $shops);
或者将wishList
功能移至您的Search
班级