天天看點

php 關于分頁循環改變字段資料方法 解決Indirect modification of overloaded報錯

$res =Db::name('member')
        ->where($query)
        ->order('uid desc')
        ->paginate(
            $param['pageSize'],        //設定目前展示條數
            false,
            ["page" => $param['page']  //設定目前頁碼
		])->each(function($item, $key){
			$item['password'] = think_ucenter_decrypt($item['password'],config('PWD_KEY'));
			return $item;
		});   
           

此方法 解決了 分頁後 想要改變數組中 某一字段的 附值 強烈推薦