How to return multiple arrays from a function in codeigniter?

前端 未结 2 447
失恋的感觉
失恋的感觉 2021-01-14 16:04

I am having this function in my controller.

function get_data($year, $month) {

        $query = $this->db->select(\'date,name,type\')->from(\'books         


        
2条回答
  •  旧时难觅i
    2021-01-14 16:42

    From your code, I don't know what result you expect by combining all data which is in $data, $data1 and $data2.

    but you can try array_merge(array1,array2,array3...) function if you want all data where key starting from 0 and increases by 1 for each value.

    Or else you can create another array with all data values like,

    return array("data" => $data, "data1" => $data1, "data2" => $data2)

    by this way you can achieve what you want.

提交回复
热议问题